diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 6477b03f07..54d80df8e5 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 +/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 @@ -375,6 +379,7 @@ /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 @@ -457,7 +463,7 @@ /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 +475,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 +487,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 +508,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,16 +520,23 @@ /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/case-sensitive-paths-webpack-plugin/ @r3nya /types/caseless/ @downace @mastermatt /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/cesium/ @Zuzon @hnipps @szechyjs @golyalpha @@ -561,11 +577,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 +591,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 @@ -627,6 +643,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 +654,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 +664,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 +673,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 +691,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,9 +701,7 @@ /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 @@ -692,16 +710,17 @@ /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 @@ -785,6 +804,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 @@ -814,6 +834,7 @@ /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 +866,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 +876,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 +915,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 +926,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,13 +940,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/debug/ @swook @galtalmor @zamb3zi @brasten @npenin /types/decamelize/ @samverschueren /types/decay/ @enaeseth /types/decode-entities/ @waspothegreat @@ -934,6 +957,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 +970,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 +985,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 @@ -997,7 +1018,7 @@ /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 @@ -1049,8 +1070,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 +1087,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 @@ -1083,7 +1107,7 @@ /types/easy-xapi/ @DeadAlready /types/easy-xapi-utils/ @DeadAlready /types/ebongarde-root/ @Ebongarde -/types/echarts/ @xieisabug @AntiMoron @liveangela @Ovilia @iRON5 +/types/echarts/ @xieisabug @AntiMoron @liveangela @Ovilia @iRON5 @bilalucar /types/ecma-proposal-math-extensions/ @ksm2 /types/ecurve/ @mhegazy /types/ed25519/ @erikma @@ -1151,7 +1175,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 +1203,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 +1244,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,9 +1277,11 @@ /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/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo @levansuper @ihmpavel @burtek @jkillian @satya164 @vinitsood +/types/expo/v31/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo @levansuper @ihmpavel @burtek @jkillian @satya164 /types/expo/v30/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo /types/expo/v27/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo /types/expo/v26/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @tinaroh @@ -1263,6 +1289,7 @@ /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 +1340,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,7 +1360,7 @@ /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 @@ -1346,7 +1374,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 +1383,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 +1399,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 @@ -1405,7 +1429,7 @@ /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 +1491,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 +1710,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 @@ -1708,7 +1733,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 +1761,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 +1780,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 +1808,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 +1820,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 @@ -1817,7 +1845,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 +1873,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 +1927,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 +1936,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,12 +1978,13 @@ /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 @@ -1969,15 +2000,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 +2017,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 +2035,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,9 +2043,10 @@ /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 @@ -2028,13 +2063,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 @@ -2075,6 +2107,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 +2118,12 @@ /types/iniparser/ @chrootsu /types/init-package-json/ @kfarnung /types/ink/ @cprecioso +/types/ink-spinner/ @lukostry +/types/ink-table/ @lukostry +/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 +2134,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 +2170,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 +2189,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 @@ -2196,7 +2234,7 @@ /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 @@ -2240,14 +2278,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 +2305,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 +2461,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 +2492,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 +2513,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 @@ -2515,7 +2556,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 +2567,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 +2582,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 +2590,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 +2622,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 +2636,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 +2662,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 +2701,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 +2755,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 @@ -2726,6 +2771,7 @@ /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 +3083,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 +3090,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 +3104,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 +3123,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 +3137,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 +3155,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 +3223,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 +3263,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 @@ -3279,18 +3326,19 @@ /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/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/ @horiuchi @lukasz-zak @Alorel @jendrikw @ethanresnick @vologab @jussikinnula @ondratra @alfirin @idandrd @various89 @Fazendaaa @NormanPerrin @danmana @stablio @emmanuelgautier @frontendmonster @mingchen @penumbra1 /types/mongoose/v4/ @simonxca @horiuchi @lukasz-zak /types/mongoose-auto-increment/ @AyaMorisawa /types/mongoose-deep-populate/ @AyaMorisawa @@ -3315,8 +3363,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 @@ -3344,6 +3391,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 +3417,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 +3487,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 +3509,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,6 +3523,7 @@ /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 @@ -3485,6 +3538,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 +3560,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 +3577,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,10 +3590,12 @@ /types/npm-email/ @BendingBender /types/npm-keyword/ @BendingBender /types/npm-license-crawler/ @ffflorian +/types/npm-list-author-packages/ @ffflorian /types/npm-name/ @BendingBender /types/npm-package-arg/ @mgroenhoff @OiYouYeahYou /types/npm-packlist/ @ajafff /types/npm-paths/ @BendingBender +/types/npm-registry-package-info/ @ffflorian /types/npm-run-path/ @BendingBender /types/npm-user/ @BendingBender /types/npm-user-packages/ @BendingBender @@ -3548,6 +3603,7 @@ /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 +3616,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 +3647,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 +3661,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 @@ -3628,9 +3689,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,25 +3717,19 @@ /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 @@ -3685,7 +3737,6 @@ /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 +3745,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 +3767,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 @@ -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/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,7 @@ /types/phantom/ @horiuchi @llRandom /types/phantomcss/ @abauzac /types/phantomjs/ @jedhunsaker @keesey -/types/phoenix/ @mciastek +/types/phoenix/ @mciastek @John-Goff @princemaple /types/phone/ @DxCx /types/phone-formatter/ @westy92 /types/phonegap/ @borisyankov @DickvdBrink @@ -3839,7 +3892,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 +3906,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 +3917,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 +3952,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 @@ -3928,12 +3983,14 @@ /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 +3999,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 +4027,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,6 +4044,7 @@ /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/proton-native/ @khanhas @ltetzlaff @@ -4004,7 +4063,7 @@ /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 @@ -4035,7 +4094,6 @@ /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 @@ -4053,7 +4111,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 +4149,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 +4160,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 @threepointone @saranshkataria /types/react/v15/ @bbenezech @pzavolinsky @digiguru @ericanderson @tkrotoff @DovydasNavickas @onigoetz /types/react-adal/ @dkorolev1 /types/react-albus/ @sseppola @conradreuter @kuirak @@ -4116,10 +4174,10 @@ /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-avatar-editor/ @diogocorrea @gabsprates @lsenta @davidspiess /types/react-beautiful-dnd/ @varHarrie @bradleyayers @paustint @marknelissen @enricoboccadifuoco @lonyele /types/react-better-password/ @mhuynh1 -/types/react-big-calendar/ @piotrwitek @paustint @pikpok @eps1lon @strongpauly @janb87 +/types/react-big-calendar/ @piotrwitek @paustint @pikpok @eps1lon @strongpauly @janb87 @ldthorne /types/react-blessed/ @me /types/react-body-classname/ @mhegazy /types/react-bootstrap/ @walkerburgin @vsiao @danilojrr @Batbold-Gansukh @octatone @chengsieuly @mretolaza @katbusch @vitosamson @LKay @aaronbeall @jrakotoharisoa @r3nya @t49tran @bes @@ -4127,7 +4185,7 @@ /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,7 +4195,7 @@ /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 @@ -4149,11 +4207,12 @@ /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 @@ -4166,15 +4225,16 @@ /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 @@ -4224,7 +4284,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 +4299,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 @@ -4256,9 +4315,11 @@ /types/react-json-tree/ @gnestor @zainafzal08 /types/react-jsonschema-form/ @iamdanfox @iplus26 @phbou72 @LucianBuzzo @sthenault @sbusch /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,6 +4330,7 @@ /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 @@ -4276,9 +4338,10 @@ /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 /types/react-native-android-taskdescription/ @christianchown /types/react-native-auth0/ @ascariandrea @marknelissen /types/react-native-autocomplete-input/ @ifiokjr @@ -4318,10 +4381,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 +4403,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 +4414,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 +4423,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 @@ -4372,8 +4438,8 @@ /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 +4457,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 +4465,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 +4488,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 +4520,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,14 +4560,14 @@ /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 @@ -4513,11 +4582,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 @@ -4553,7 +4622,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 +4678,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 @@ -4630,6 +4702,7 @@ /types/resemblejs/ @pimterry /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 +4725,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 @@ -4684,6 +4758,7 @@ /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 @@ -4707,6 +4782,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 +4852,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 +4876,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 +4916,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 +4926,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 +4934,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 +4946,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 +4962,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 @@ -4944,7 +5024,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 +5034,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 +5063,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 +5081,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 +5091,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 +5107,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 +5131,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,14 +5169,16 @@ /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 @@ -5133,7 +5220,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 @saranshkataria @0xJoKe /types/stripe-checkout/ @cgwrench /types/stripe-v2/ @ejsmith @amritk @adamcmiel @jleider @galuszkak /types/stripe-v3/ @ejsmith @amritk @adamcmiel @jleider @galuszkak @slangeder @@ -5144,11 +5231,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 +5252,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 +5313,18 @@ /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/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 +5344,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 +5363,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 @@ -5305,13 +5394,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 +5411,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 @@ -5352,6 +5443,7 @@ /types/trianglify/ @unindented /types/trie-prefix-tree/ @jlismore /types/trim/ @skysteve +/types/trim-newlines/ @djcsdy /types/triple-beam/ @danwbyrne /types/triplesec/ @threesquared /types/trunk8/ @niemyjski @@ -5361,6 +5453,7 @@ /types/tspromise/ @soywiz /types/ttf2woff2/ @ThomasdenH /types/tunnel/ @BendingBender +/types/turndown/ @sergey-zhidkov /types/tus-js-client/ @kevhiggins @Acconut /types/tv4/ @Bartvds @psnider /types/tween.js/ @Amos47 @sunetos @jzarnikov @alexburner @@ -5370,8 +5463,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 +5520,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 +5552,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,11 +5594,11 @@ /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 /types/video.js/ @vbortone @scleriot @SWBennett06 @IgelCampus @giofreitas @gjanblaszczyk @sroucheray @AkxeOne @meikidd /types/viewability-helper/ @lironzluf /types/viewerjs/ @lrh3321 @@ -5529,7 +5627,9 @@ /types/voronoi-diagram/ @michaelneu /types/vorpal/ @danwbyrne /types/vortex-web-client/ @Pro +/types/voucher-code-generator/ @JWebCoder /types/voximplant-websdk/ @aylarov +/types/vue-chartkick/ @cnsmedia /types/vue-color/ @me /types/vue-markdown/ @neodon /types/vue-resource/ @kaorun343 @@ -5544,8 +5644,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 +5672,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 +5693,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 +5710,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 +5761,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 +5827,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,6 +5839,7 @@ /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 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/notNeededPackages.json b/notNeededPackages.json index 0edaa82c1e..bd141916cf 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -216,12 +216,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", @@ -264,6 +276,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", @@ -522,6 +540,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", @@ -690,6 +714,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", @@ -1014,6 +1044,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", @@ -1038,6 +1074,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", @@ -1110,6 +1152,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", @@ -1134,12 +1182,6 @@ "sourceRepoURL": "https://github.com/theoephraim/node-pg-migrate#readme", "asOfVersion": "2.15.0" }, - { - "libraryName": "png-async", - "typingsPackageName": "png-async", - "sourceRepoURL": "https://github.com/kanreisa/node-png-async", - "asOfVersion": "0.9.4" - }, { "libraryName": "node-waves", "typingsPackageName": "node-waves", @@ -1170,12 +1212,24 @@ "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-event", "typingsPackageName": "p-event", @@ -1278,12 +1332,24 @@ "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": "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", @@ -1326,6 +1392,12 @@ "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": "Raven JS", "typingsPackageName": "raven-js", @@ -1968,6 +2040,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.0" + }, { "libraryName": "zetapush-js", "typingsPackageName": "zetapush-js", 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..419d8e4b1d --- /dev/null +++ b/types/amap-js-api/array-bounds.d.ts @@ -0,0 +1,10 @@ +declare namespace AMap { + class ArrayBounds { + constructor(bounds: LocationValue[]); + bounds: LngLat[]; + 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..63e880fe65 --- /dev/null +++ b/types/amap-js-api/bounds.d.ts @@ -0,0 +1,12 @@ +declare namespace AMap { + class Bounds { + constructor(southWest: LngLat, northEast: LngLat); + contains(point: LocationValue): boolean; + 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..71bfaa8fea --- /dev/null +++ b/types/amap-js-api/browser.d.ts @@ -0,0 +1,51 @@ +declare namespace AMap { + namespace Browser { + const ua: string; + const mobile: boolean; + const plat: 'android' | 'ios' | 'windows' | 'mac' | 'other'; + const mac: boolean; + const windows: boolean; + const ios: boolean; + const iPad: boolean; + const iPhone: boolean; + const android: boolean; + const android23: boolean; + const chrome: boolean; + const firefox: boolean; + const safari: boolean; + const wechat: boolean; + const uc: boolean; + const qq: boolean; + const ie: boolean; + const ie6: boolean; + const ie7: boolean; + const ie8: boolean; + const ie9: boolean; + const ie10: boolean; + const ie11: boolean; + const edge: boolean; + const ielt9: boolean; + const baidu: boolean; + const isLocalStorage: boolean; + const isGeolocation: boolean; + const mobileWebkit: boolean; + const mobileWebkit3d: boolean; + const mobileOpera: boolean; + const retina: boolean; + const touch: boolean; + const msPointer: boolean; + const pointer: boolean; + const webkit: boolean; + const ie3d: boolean; + const webkit3d: boolean; + const gecko3d: boolean; + const opera3d: boolean; + const any3d: boolean; + const isCanvas: boolean; + const isSvg: boolean; + const isVML: boolean; + const isWorker: boolean; + const isWebsocket: boolean; + 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..3d51dc719e --- /dev/null +++ b/types/amap-js-api/common.d.ts @@ -0,0 +1,22 @@ +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..9fe1f1e76d --- /dev/null +++ b/types/amap-js-api/convert-from.d.ts @@ -0,0 +1,15 @@ +declare namespace AMap { + namespace convertFrom { + interface Result { + info: string; // 'ok' + locations: LngLat[]; + } + type Type = 'gps' | 'baidu' | 'mapbar'; + type SearchStatus = 'complete' | 'error'; + } + 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..d83a2ca69a --- /dev/null +++ b/types/amap-js-api/dom-util.d.ts @@ -0,0 +1,31 @@ +declare namespace AMap { + namespace DomUtil { + function getViewport(dom: HTMLElement): Size; + + function getViewportOffset(dom: HTMLElement): Pixel; + + function create( + tagName: K, + parent?: HTMLElement, + className?: string + ): HTMLElementTagNameMap[K]; + + function setClass(dom: HTMLElement, className?: string): void; + + function hasClass(dom: HTMLElement, className: string): boolean; + + function addClass(dom: HTMLElement, className: string): void; + + function removeClass(dom: HTMLElement, className: string): void; + + function setOpacity(dom: HTMLElement, opacity: number): void; + + function rotate(dom: HTMLElement, deg: number, origin?: { x: number, y: number }): void; + + function setCss(dom: HTMLElement | HTMLElement[], style: Partial): typeof DomUtil; // this + + function empty(dom: HTMLElement): void; + + 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..d8ff5753c9 --- /dev/null +++ b/types/amap-js-api/event.d.ts @@ -0,0 +1,59 @@ +declare namespace AMap { + abstract class EventEmitter { + on( + eventName: string, + // tslint:disable-next-line:no-unnecessary-generics + handler: (this: C, event: E) => void, + context?: C, + once?: boolean, + unshift?: boolean + ): this; + + off( + eventName: string, + // tslint:disable-next-line + handler: ((this: C, event: E) => void) | 'mv', + context?: C + ): this; + + emit(eventName: string, data?: any): this; + } + + namespace event { + interface EventListener { + type: T; + } + + 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>; + + 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>; + + 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>; + + function removeListener(listener: EventListener<0 | 1>): void; + + 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..03f6800088 --- /dev/null +++ b/types/amap-js-api/geometry-util.d.ts @@ -0,0 +1,122 @@ +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]>; + + function closestOnSegment( + point1: LocationValue, + point2: LocationValue, + point3: LocationValue + ): [number, number]; + + function closestOnLine(point: LocationValue, line: LocationValue[]): [number, number]; + + function distanceToSegment( + point1: LocationValue, + point2: LocationValue, + point3: LocationValue + ): number; + + function distanceToLine(point: LocationValue, line: LocationValue[]): number; + + function isPointOnSegment( + point1: LocationValue, + point2: LocationValue, + point3: LocationValue, + tolerance?: number + ): boolean; + + function isPointOnLine( + point: LocationValue, + line: LocationValue[], + tolerance?: number + ): boolean; + + function isPointOnRing( + point: LocationValue, + ring: LocationValue[], + tolerance?: number + ): boolean; + + 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..30dd7c4092 --- /dev/null +++ b/types/amap-js-api/layer/building.d.ts @@ -0,0 +1,30 @@ +declare namespace AMap { + namespace Buildings { + interface Options extends Layer.Options { + zooms?: [number, number]; + opacity?: number; + 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 { + constructor(opts?: Buildings.Options); + 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..bdb4001a7c --- /dev/null +++ b/types/amap-js-api/layer/flexible.d.ts @@ -0,0 +1,20 @@ +declare namespace AMap { + namespace TileLayer { + namespace Flexible { + interface Options extends TileLayer.Options { + createTile?( + x: number, + y: number, + z: number, + success: (tile: HTMLImageElement | HTMLCanvasElement) => void, + fail: () => void + ): void; + cacheSize?: number; + visible?: boolean; + } + } + class Flexible extends TileLayer { + 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..8f35d949fd --- /dev/null +++ b/types/amap-js-api/layer/layer.d.ts @@ -0,0 +1,20 @@ +declare namespace AMap { + namespace Layer { + interface Options { + map?: Map; + } + } + + abstract class Layer extends EventEmitter { + getContainer(): HTMLDivElement | undefined; + getZooms(): [number, number]; + setOpacity(alpha: number): void; + getOpacity(): number; + show(): void; + hide(): void; + setMap(map?: Map | null): void; + getMap(): Map | null | undefined; + 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..4cc463eef7 --- /dev/null +++ b/types/amap-js-api/layer/layerGroup.d.ts @@ -0,0 +1,21 @@ +declare namespace AMap { + class LayerGroup extends Layer { + constructor(layers: L | L[]); + addLayer(layer: L | L[]): this; + addLayers(layers: L | L[]): this; + getLayers(): L[]; + getLayer(finder: (this: null, item: L, index: number, list: L[]) => boolean): L | null; + hasLayer(layer: L | ((this: null, item: L, index: number, list: L[]) => boolean)): boolean; + removeLayer(layer: L | L[]): this; + removeLayers(layer: L | L[]): this; + clearLayers(): this; + 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..1ab5464a5b --- /dev/null +++ b/types/amap-js-api/layer/massMarks.d.ts @@ -0,0 +1,47 @@ +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 { + 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 { + constructor(data: D[] | string, opts: MassMarks.Options); + setStyle(style: MassMarks.Style | MassMarks.Style[]): void; + getStyle(): MassMarks.Style | MassMarks.Style[]; + 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..a38f5ba025 --- /dev/null +++ b/types/amap-js-api/layer/mediaLayer.d.ts @@ -0,0 +1,35 @@ +declare namespace AMap { + namespace MediaLayer { + interface Options extends Layer.Options { + bounds?: Bounds; + visible?: boolean; + zooms?: [number, number]; + opacity?: number; + } + } + + abstract class MediaLayer extends Layer { + constructor(options?: MediaLayer.Options); + setBounds(bounds: Bounds): void; + getBounds(): Bounds; + setOptions(options: Partial): void; + getOptions(): Partial; + getElement(): E | null; + } + + class ImageLayer extends MediaLayer { + setImageUrl(url: string): void; + getImageUrl(): string | undefined; + } + + class VideoLayer extends MediaLayer { + setVideoUrl(source: string | string[]): void; + getVideoUrl(): string | string[] | undefined; + } + + class CanvasLayer extends MediaLayer { + setCanvas(canvas: HTMLCanvasElement): void; + getCanvas(): HTMLCanvasElement | undefined; + 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..7576a70664 --- /dev/null +++ b/types/amap-js-api/layer/tileLayer.d.ts @@ -0,0 +1,37 @@ +declare namespace AMap { + namespace TileLayer { + interface EventMap { + complete: Event<'complete'>; + } + + interface Options extends Layer.Options { + tileSize?: number; + 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 { + constructor(options?: Traffic.Options); + } + } + + class TileLayer extends Layer { + constructor(options?: TileLayer.Options); + getTiles(): string[]; + reload(): void; + 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..c4561ddf14 --- /dev/null +++ b/types/amap-js-api/layer/wms.d.ts @@ -0,0 +1,29 @@ +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 { + url: string; + params: Params; + blend?: boolean; + } + } + class WMS extends Flexible { + constructor(options: WMS.Options); + setUrl(url: string): void; + getUrl(): string; + setParams(params: WMS.Params): void; + 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..5d85e5df48 --- /dev/null +++ b/types/amap-js-api/layer/wmts.d.ts @@ -0,0 +1,25 @@ +declare namespace AMap { + namespace TileLayer { + namespace WMTS { + interface Params { + Version?: string; + Layer?: string; + Style?: string; + Format?: string; + } + interface Options extends Flexible.Options { + url: string; + params: Params; + blend?: boolean; + } + } + + class WMTS extends Flexible { + constructor(options: WMTS.Options); + setUrl(url: string): void; + getUrl(): string; + setParams(params: WMTS.Params): void; + 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..4247002b2b --- /dev/null +++ b/types/amap-js-api/lngLat.d.ts @@ -0,0 +1,17 @@ +declare namespace AMap { + class LngLat { + constructor(lng: number, lat: number, noAutofix?: boolean); + offset(east: number, north: number): LngLat; + distance(lnglat: LngLat | LngLat[]): number; + getLng(): number; + getLat(): number; + 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..46edc68577 --- /dev/null +++ b/types/amap-js-api/map.d.ts @@ -0,0 +1,187 @@ +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; + isHotspot?: boolean; + defaultLayer?: TileLayer; + rotateEnable?: boolean; + resizeEnable?: boolean; + showIndoorMap?: boolean; + expandZoomRange?: boolean; + dragEnable?: boolean; + zoomEnable?: boolean; + doubleClickZoom?: boolean; + keyboardEnable?: boolean; + jogEnable?: boolean; + scrollWheel?: boolean; + touchZoom?: boolean; + touchZoomCenter?: number; + mapStyle?: string; + features?: Feature[] | 'all' | Feature; + showBuildingBlock?: boolean; + viewMode?: ViewMode; + pitch?: number; + pitchEnable?: boolean; + buildingAnimation?: boolean; + skyColor?: string; + preloadMode?: boolean; + 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 { + constructor(container: string | HTMLElement, opts?: Map.Options); + poiOnAMAP(obj: { id: string; location?: LocationValue; name?: string }): void; + 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; + getLimitBounds(): Bounds; + getLang(): Lang; + getSize(): Size; + getRotation(): number; + getStatus(): Map.Status; + getDefaultCursor(): string; + getResolution(point?: LocationValue): number; + getScale(dpi?: number): number; + setZoom(level: number): void; + setLabelzIndex(index: number): void; + setLayers(layers: Layer[]): void; + add(overlay: Overlay | Overlay[]): void; + remove(overlay: Overlay | Overlay[]): void; + getAllOverlays(type?: 'marker' | 'circle' | 'polyline' | 'polygon'): Overlay[]; + setCenter(center: LocationValue): void; + setZoomAndCenter(zoomLevel: number, center: LocationValue): void; + setCity(city: string, callback: (this: this, coord: [string, string], zoom: number) => void): void; + setBounds(bound: Bounds): Bounds; + setLimitBounds(bound: Bounds): void; + clearLimitBounds(): void; + setLang(lang: Lang): void; + setRotation(rotation: number): void; + setStatus(status: Partial): void; + setDefaultCursor(cursor: string): void; + zoomIn(): void; + zoomOut(): void; + panTo(position: LocationValue): void; + panBy(x: number, y: number): void; + setFitView( + overlayList?: Overlay | Overlay[], + immediately?: boolean, + avoid?: [number, number, number, number], + maxZoom?: number + ): Bounds | false | undefined; + clearMap(): void; + destroy(): void; + plugin(name: string | string[], callback: () => void): this; + addControl(control: {}): void; // TODO + removeControl(control: {}): void; // TODO + clearInfoWindow(): void; + pixelToLngLat(pixel: Pixel, level?: number): LngLat; + lnglatToPixel(lnglat: LocationValue, level?: number): Pixel; + containerToLngLat(pixel: Pixel): LngLat; + lngLatToContainer(lnglat: LocationValue): Pixel; + lnglatTocontainer(lnglat: LocationValue): Pixel; + setMapStyle(style: string): void; + getMapStyle(): string; + setFeatures(feature: Map.Feature | Map.Feature[] | 'all'): void; + getFeatures(): Map.Feature | Map.Feature[] | 'all'; + setDefaultLayer(layer: TileLayer): void; + 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..5778cb72a6 --- /dev/null +++ b/types/amap-js-api/overlay/bezierCurve.d.ts @@ -0,0 +1,22 @@ +declare namespace AMap { + namespace BezierCurve { + interface EventMap extends Polyline.EventMap { } + type Options = Merge, { + // internal + path: Array>>; + tolerance?: number; + interpolateNumLimit?: [number | number]; + }>; + + interface GetOptionsResult extends Polyline.GetOptionsResult { + path: Array; + } + } + class BezierCurve extends Polyline { + 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..2a1cbd9020 --- /dev/null +++ b/types/amap-js-api/overlay/circle.d.ts @@ -0,0 +1,49 @@ +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 { + constructor(options?: Circle.Options); + setCenter(center: LocationValue, preventEvent?: boolean): void; + getCenter(): LngLat | undefined; + getBounds(): Bounds | null; + setRadius(radius: number, preventEvent?: boolean): void; + getRadius(): number; + setOptions(options?: Circle.Options): void; + getOptions(): Partial>; + 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..13e4162f46 --- /dev/null +++ b/types/amap-js-api/overlay/circleMarker.d.ts @@ -0,0 +1,4 @@ +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..72c7fc2852 --- /dev/null +++ b/types/amap-js-api/overlay/contextMenu.d.ts @@ -0,0 +1,23 @@ +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 { + constructor(options?: ContextMenu.Options); + addItem(text: string, fn: (this: HTMLLIElement) => void, num?: number): void; + removeItem(test: string, fn: (this: HTMLLIElement) => void): void; + 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..55feaf3112 --- /dev/null +++ b/types/amap-js-api/overlay/ellipse.d.ts @@ -0,0 +1,27 @@ +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 { + constructor(options?: Ellipse.Options); + getCenter(): LngLat | undefined; + setCenter(center: LocationValue, preventEvent?: boolean): void; + 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..75098a59f0 --- /dev/null +++ b/types/amap-js-api/overlay/geoJSON.d.ts @@ -0,0 +1,43 @@ +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?: GeoJSONObject | GeoJSONObject[]; + getMarker?(obj: GeoJSONObject, lnglat: LngLat): Marker; + getPolyline?(obj: GeoJSONObject, lnglats: LngLat[]): Polyline; + getPolygon?(obj: GeoJSONObject, lnglats: LngLat[]): Polygon; + coordsToLatLng?(lnglat: LngLat): LngLat; + + // internal + coordsToLatLngs?(lnglats: LngLat[]): LngLat[]; + } + } + + class GeoJSON extends OverlayGroup { + constructor(options?: GeoJSON.Options); + importData(obj: GeoJSON.GeoJSONObject | GeoJSON.GeoJSONObject[]): void; + 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..be300feef3 --- /dev/null +++ b/types/amap-js-api/overlay/icon.d.ts @@ -0,0 +1,16 @@ +declare namespace AMap { + namespace Icon { + interface Options { + size?: SizeValue; + imageOffset?: Pixel; + image?: string; + imageSize?: SizeValue; + } + } + + class Icon extends EventEmitter { + constructor(options?: Icon.Options); + 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..54bedd95a8 --- /dev/null +++ b/types/amap-js-api/overlay/infoWindow.d.ts @@ -0,0 +1,37 @@ +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 { + constructor(options?: InfoWindow.Options); + open(map: Map, position?: LocationValue): void; + close(): void; + getIsOpen(): boolean; + setContent(content: string | HTMLElement): void; + getContent(): string | HTMLElement | undefined; + setPosition(lnglat: LocationValue): void; + getPosition(): LngLat | undefined; + 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..e24ce7be8f --- /dev/null +++ b/types/amap-js-api/overlay/marker.d.ts @@ -0,0 +1,103 @@ +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; + topWhenClick?: boolean; + 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; + zooms?: [number, number]; + + // internal + topWhenMouseOver?: boolean; + height?: number; + } + } + + class Marker extends Overlay { + constructor(options?: Marker.Options); + markOnAMAP(obj?: { name?: string, position?: LocationValue }): void; + getOffset(): Pixel; + setOffset(offset: Pixel): void; + setAnimation(animate: AnimationName, prevent?: boolean): void; + getAnimation(): AnimationName; + setClickable(cilckable: boolean): void; + getClickable(): boolean; + getPosition(): LngLat | undefined; + setPosition(position: LocationValue): void; + setAngle(angle: number): void; + setLabel(label?: Marker.Label): void; + getLabel(): Marker.Label | undefined; + getAngle(): number; + setzIndex(index: number): void; + getzIndex(): number; + setIcon(content: string | Icon): void; + getIcon(): string | Icon | undefined; + setDraggable(draggable: boolean): void; + getDraggable(): boolean; + setCursor(cursor: string): void; + setContent(content: string | HTMLElement): void; + getContent(): string | HTMLElement; + moveAlong( + path: LngLat[], + speed: number, + timingFunction?: (t: number) => number, + circleable?: boolean + ): void; + moveTo( + path: LocationValue, + speed: number, + timingFunction?: (t: number) => number + ): void; + stopMove(): void; + pauseMove(): boolean; + resumeMove(): boolean; + setMap(map: null | Map): void; + setTitle(title: string): void; + getTitle(): string | undefined; + setTop(isTop: boolean): void; + getTop(): boolean; + setShadow(icon?: Icon | string): void; + getShadow(): Icon | undefined | string; + 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..f0d6c39bac --- /dev/null +++ b/types/amap-js-api/overlay/markerShape.d.ts @@ -0,0 +1,21 @@ +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 { + 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..1726b39c3e --- /dev/null +++ b/types/amap-js-api/overlay/overlay.d.ts @@ -0,0 +1,37 @@ +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; + setMap(map: Map | null): void; + 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..d397505b04 --- /dev/null +++ b/types/amap-js-api/overlay/overlayGroup.d.ts @@ -0,0 +1,30 @@ +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 { + constructor(overlays?: O | O[]); + addOverlay(overlay: O | O[]): this; + addOverlays(overlay: O | O[]): this; + getOverlays(): O[]; + hasOverlay(overlay: O | ((this: null, item: O, index: number, list: O[]) => boolean)): boolean; + removeOverlay(overlay: O | O[]): this; + removeOverlays(overlay: O | O[]): this; + clearOverlays(): this; + eachOverlay(iterator: (this: C, overlay: O, index: number, overlays: O[]) => void, context?: C): this; + setMap(map: null | Map): this; + setOptions(options: ReferOverlayOptions): this; + show(): this; + hide(): this; + + 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..de21aa35a7 --- /dev/null +++ b/types/amap-js-api/overlay/pathOverlay.d.ts @@ -0,0 +1,20 @@ +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..8792e0e135 --- /dev/null +++ b/types/amap-js-api/overlay/polygon.d.ts @@ -0,0 +1,32 @@ +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 { + constructor(options?: Polygon.Options); + setPath(path: LocationValue[] | LocationValue[][]): void; + getPath(): LngLat[] | LngLat[][]; + setOptions(options: Polygon.Options): void; + getOptions(): Partial< + this extends Omit ? Ellipse.GetOptionsResult : + this extends Omit ? Rectangle.GetOptionsResult : + Polygon.GetOptionsResult + >; + getArea(): number; + 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..207279b208 --- /dev/null +++ b/types/amap-js-api/overlay/polyline.d.ts @@ -0,0 +1,46 @@ +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 { + constructor(options?: BezierCurve.Options | Polyline.Options); + setPath( + path: this extends Omit ? + Array>> + : LocationValue[] + ): void; + getPath(): this extends Omit ? + Array + : LngLat[]; + getLength(): number; + 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..259e2072de --- /dev/null +++ b/types/amap-js-api/overlay/rectangle.d.ts @@ -0,0 +1,21 @@ +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 { + constructor(options?: Rectangle.Options); + setBounds(bounds: Bounds, preventEvent?: boolean): void; + 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..b8f239aac1 --- /dev/null +++ b/types/amap-js-api/overlay/shapeOverlay.d.ts @@ -0,0 +1,30 @@ +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 { + abstract setOptions(options: {}): void; + abstract getOptions(): {}; + getzIndex(): number; + 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..db15ae08ce --- /dev/null +++ b/types/amap-js-api/overlay/text.d.ts @@ -0,0 +1,19 @@ +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 { + constructor(options?: Text.Options); + getText(): string; + setText(text: string): void; + 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..fab4605b7a --- /dev/null +++ b/types/amap-js-api/pixel.d.ts @@ -0,0 +1,17 @@ +declare namespace AMap { + class Pixel { + constructor(x: number, y: number, round?: boolean); + getX(): number; + getY(): number; + 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..12a1e25423 --- /dev/null +++ b/types/amap-js-api/size.d.ts @@ -0,0 +1,10 @@ +declare namespace AMap { + class Size { + 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/make-dir/tslint.json b/types/amap-js-api/tslint.json similarity index 100% rename from types/make-dir/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..70b48c31d1 --- /dev/null +++ b/types/amap-js-api/util.d.ts @@ -0,0 +1,37 @@ +declare namespace AMap { + namespace Util { + function colorNameToHex(colorName: string): string; + + function rgbHex2Rgba(hex: string): string; + + function argbHex2Rgba(hex: string): string; + + function isEmpty(obj: object): boolean; + + function deleteItemFromArray(array: T[], item: T): T[]; + + function deleteItemFromArrayByIndex(array: T[], index: number): T[]; + + function indexOf(array: T[], item: T): number; + + function format(floatNumber: number, digits?: number): number; + + function isArray(data: any): data is any[]; + + function isDOM(data: any): data is HTMLElement; + + 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..d662b4c50e --- /dev/null +++ b/types/amap-js-api/view2D.d.ts @@ -0,0 +1,13 @@ +declare namespace AMap { + namespace View2D { + interface Options { + center?: LocationValue; + rotation?: number; + zoom?: number; + crs?: 'EPGS3857' | 'EPGS3395' | 'EPGS4326'; + } + } + class View2D extends EventEmitter { + constructor(options?: View2D.Options); + } +} diff --git a/types/aws-lambda/aws-lambda-tests.ts b/types/aws-lambda/aws-lambda-tests.ts index ad063c20b6..dc5f9b3eba 100644 --- a/types/aws-lambda/aws-lambda-tests.ts +++ b/types/aws-lambda/aws-lambda-tests.ts @@ -1003,7 +1003,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 +1047,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 d3bee679b3..910324d7ab 100644 --- a/types/aws-lambda/index.d.ts +++ b/types/aws-lambda/index.d.ts @@ -879,11 +879,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; } diff --git a/types/axe-webdriverjs/index.d.ts b/types/axe-webdriverjs/index.d.ts index 3b6aab18ce..8dfdb7da2e 100644 --- a/types/axe-webdriverjs/index.d.ts +++ b/types/axe-webdriverjs/index.d.ts @@ -1,7 +1,7 @@ // Type definitions for axe-webdriverjs 2.1 // Project: https://github.com/dequelabs/axe-webdriverjs#readme // Definitions by: Joshua Goldberg -// Tyler Krupicka +// Tyler Krupicka // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 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/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/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/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/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/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/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/cesium/index.d.ts b/types/cesium/index.d.ts index 398d05ad33..086d7c24b4 100644 --- a/types/cesium/index.d.ts +++ b/types/cesium/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for cesium 1.47 +// Type definitions for cesium 1.54 // Project: http://cesiumjs.org // Definitions by: Aigars Zeiza // Harry Nicholls @@ -706,8 +706,8 @@ declare namespace Cesium { class Event { numberOfListeners: number; - addEventListener(listener: () => void, scope?: any): Event.RemoveCallback; - removeEventListener(listener: () => void, scope?: any): boolean; + addEventListener(listener: (...args: any[]) => void, scope?: any): Event.RemoveCallback; + removeEventListener(listener: (...args: any[]) => void, scope?: any): boolean; raiseEvent(...args: any[]): void; } @@ -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; @@ -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; 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/chart.js/index.d.ts b/types/chart.js/index.d.ts index c601631280..8da7ed0814 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -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; 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/clone-deep/clone-deep-tests.ts b/types/clone-deep/clone-deep-tests.ts new file mode 100644 index 0000000000..0e99c6fbb2 --- /dev/null +++ b/types/clone-deep/clone-deep-tests.ts @@ -0,0 +1,16 @@ +import cloneDeep from '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..0ca60e6180 --- /dev/null +++ b/types/clone-deep/index.d.ts @@ -0,0 +1,10 @@ +// 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 + +export default function cloneDeep( + val: T, + instanceClone?: true | ((val: T) => T) +): T; diff --git a/types/env-paths/tsconfig.json b/types/clone-deep/tsconfig.json similarity index 73% rename from types/env-paths/tsconfig.json rename to types/clone-deep/tsconfig.json index 62dcbca022..d584681520 100644 --- a/types/env-paths/tsconfig.json +++ b/types/clone-deep/tsconfig.json @@ -4,16 +4,14 @@ "lib": ["es6"], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": ["../"], "types": [], "noEmit": true, + "esModuleInterop": true, "forceConsistentCasingInFileNames": true }, - "files": [ - "index.d.ts", - "env-paths-tests.ts" - ] + "files": ["index.d.ts", "clone-deep-tests.ts"] } diff --git a/types/camelcase/tslint.json b/types/clone-deep/tslint.json similarity index 100% rename from types/camelcase/tslint.json rename to types/clone-deep/tslint.json 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/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/ora/tsconfig.json b/types/collectionsjs/tsconfig.json similarity index 82% rename from types/ora/tsconfig.json rename to types/collectionsjs/tsconfig.json index 302dc253cc..6ec4a9edc3 100644 --- a/types/ora/tsconfig.json +++ b/types/collectionsjs/tsconfig.json @@ -7,7 +7,6 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, - "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" @@ -15,10 +14,10 @@ "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true, - "esModuleInterop": true + "strictFunctionTypes": true }, "files": [ "index.d.ts", - "ora-tests.ts" + "collectionsjs-tests.ts" ] } diff --git a/types/chai-http/tslint.json b/types/collectionsjs/tslint.json similarity index 100% rename from types/chai-http/tslint.json rename to types/collectionsjs/tslint.json 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/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/condense-whitespace/tsconfig.json b/types/condense-whitespace/tsconfig.json new file mode 100644 index 0000000000..8d5705205d --- /dev/null +++ b/types/condense-whitespace/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", + "condense-whitespace-tests.ts" + ] +} diff --git a/types/conf/tslint.json b/types/condense-whitespace/tslint.json similarity index 100% rename from types/conf/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/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/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/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/conf/v0/tslint.json b/types/css-modules-loader-core/tslint.json similarity index 100% rename from types/conf/v0/tslint.json rename to types/css-modules-loader-core/tslint.json diff --git a/types/date-now/date-now-tests.ts b/types/date-now/date-now-tests.ts new file mode 100644 index 0000000000..f16487de44 --- /dev/null +++ b/types/date-now/date-now-tests.ts @@ -0,0 +1,5 @@ +import seeded = require('date-now/seed'); +import dateNow = require('date-now'); + +seeded(123); +dateNow(); diff --git a/types/date-now/index.d.ts b/types/date-now/index.d.ts new file mode 100644 index 0000000000..7ed6ab7df3 --- /dev/null +++ b/types/date-now/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for date-now 1.0 +// Project: https://github.com/Raynos/date-now +// Definitions by: Adam Zerella +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function dateNow(): number; + +export = dateNow; diff --git a/types/date-now/seed.d.ts b/types/date-now/seed.d.ts new file mode 100644 index 0000000000..c87a702c55 --- /dev/null +++ b/types/date-now/seed.d.ts @@ -0,0 +1,6 @@ +/** + * Returns a Date.now() like function that's in sync with the seed value. + */ +declare function seeded(seed: number): number; + +export = seeded; diff --git a/types/date-now/tsconfig.json b/types/date-now/tsconfig.json new file mode 100644 index 0000000000..705da71b7b --- /dev/null +++ b/types/date-now/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [ + + ], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "seed.d.ts", + "date-now-tests.ts" + ] +} diff --git a/types/date-now/tslint.json b/types/date-now/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/date-now/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/dragscroll/dragscroll-tests.ts b/types/dragscroll/dragscroll-tests.ts new file mode 100644 index 0000000000..fcf4818bf4 --- /dev/null +++ b/types/dragscroll/dragscroll-tests.ts @@ -0,0 +1,3 @@ +import * as dragscroll from "dragscroll"; + +dragscroll.reset(); diff --git a/types/dragscroll/index.d.ts b/types/dragscroll/index.d.ts new file mode 100644 index 0000000000..cd125c6591 --- /dev/null +++ b/types/dragscroll/index.d.ts @@ -0,0 +1,5 @@ +// Type definitions for dragscroll v 0.0 +// Project: https://github.com/asvd/dragscroll#readme +// Definitions by: Sean Kelly +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +export function reset(i ?: number, el ?: any): void; diff --git a/types/dragscroll/tsconfig.json b/types/dragscroll/tsconfig.json new file mode 100644 index 0000000000..20e259be9e --- /dev/null +++ b/types/dragscroll/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", + "dragscroll-tests.ts" + ] +} diff --git a/types/conf/v1/tslint.json b/types/dragscroll/tslint.json similarity index 100% rename from types/conf/v1/tslint.json rename to types/dragscroll/tslint.json diff --git a/types/dv/dv-tests.ts b/types/dv/dv-tests.ts new file mode 100644 index 0000000000..4dd9f0e88e --- /dev/null +++ b/types/dv/dv-tests.ts @@ -0,0 +1,18 @@ +import dv = require('dv'); +import fs = require('fs'); + +const image = new dv.Image('png', fs.readFileSync('textpage300.png')); +const tesseract = new dv.Tesseract('eng', image); +console.log(tesseract.findText('plain')); + +const barcodes = new dv.Image('png', fs.readFileSync('form2.png')); +const open = barcodes.thin('bg', 8, 5).dilate(3, 3); +const openMap = open.distanceFunction(8); +const openMask = openMap.threshold(10).erode(22, 22); +const boxes = openMask.invert().connectedComponents(8); +boxes.forEach((box) => { + const boxImage = barcodes.crop( + // Do something useful with our image. + box.x, box.y, + box.width, box.height); +}); diff --git a/types/dv/index.d.ts b/types/dv/index.d.ts new file mode 100644 index 0000000000..5a0447966a --- /dev/null +++ b/types/dv/index.d.ts @@ -0,0 +1,477 @@ +// Type definitions for dv 2.1 +// Project: https://github.com/creatale/node-dv +// Definitions by: taoqf +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 + +/// + +export interface Box { + x: number; + y: number; + width: number; + height: number; +} + +export interface Point { + x: number; + y: number; +} + +export interface Segment { + p1: Point; + p2: Point; + error: number; +} + +export interface Skew { + angle: number; + confidence: number; +} + +export interface Component { + x: number; + y: number; + width: number; + height: number; +} + +export class Image { + /** + * Creates a copy of otherImage. + */ + constructor(otherImage: Image); + /** + * Creates a 32 bit imagen from three 8 bit images, where each image represents one channel of RGB or HSV. + */ + constructor(image1: Image, image2: Image, image3: Image); + /** + * Creates an empty image with the specified dimensions (!!! note: this constructor is experimental and likely to change). + */ + constructor(width: number, height: number, depth: number); + /** + * Creates an image from a Buffer object, that contains the PNG/JPG encoded image. + */ + constructor(type: 'png' | 'jpg', buffer: Buffer); + constructor(type: 'rgba' | 'rgb' | 'gray', buffer: Buffer, width: number, height: number); + + readonly width: number; + readonly height: number; + /** + * The depth of the image in bits per pixel, i.e. one of 32 (color), 8 (grayscale) or 1 (monochrome). + */ + readonly depth: number; + + /** + * Returns the (boolean) inverse of this image. + */ + invert(): Image; + /** + * Returns the (boolean) union of two images with equal depth, aligning them to the upper left corner. + */ + or(otherImage: Image): Image; + /** + * Returns the (boolean) difference of two images with equal depth, aligning them to the upper left corner. + */ + and(otherImage: Image): Image; + /** + * Returns the (boolean) exclusive disjunction of two images with equal depth, aligning them to the upper left corner. + */ + xor(otherImage: Image): Image; + /** + * If the images are monochrome, dispatches to Leptonica's pixOr. Otherwise, returns the channelwise addition of b to a, clipped at 255. + */ + add(otherImage: Image): Image; + + /** + * If the images are monochrome, dispatches to Leptonica's pixSubtract and is equivalent to a.and(b.invert()). + * For grayscale images, returns the pixelwise subtraction of b from a, clipped at zero. + * For color, the entire RGB value is subtracted instead of doing channelwise subtraction (ask Leptonica why). + * @example: + * redness = colorImage.toGray(1, 0, 0).subtract(colorImage.toGray(0, 0.5, 0.5)) + */ + subtract(otherImage: Image): Image; + /** + * Applies a convoltuion kernel with the specified dimensions. Image convolution is an operation where each destination pixel is computed based on a weighted sum of a set of nearby source pixels. + */ + convolve(halfWidth: number, halfHeight: number): Image; + + /** + * Unsharp Masking creates an unsharp mask using halfWidth. + * The fraction determines how much of the edge is added back into image. + * The resulting image appears clearer, but it is generally less accurate. + */ + unsharp(halfWidth: number, fraction: number): Image; + /** + * Rotates the image around its center by the specified angle in degrees. + */ + rotate(angle: number): Image; + /** + * Scales an image proportionally by scale (1.0 = 100%). + */ + scale(scale: number): Image; + + /** + * Scales an image by scaleX and scaleY (1.0 = 100%). + */ + scale(scaleX: number, scaleY: number): Image; + + /** + * Crops an image from this image by the specified rectangle and returns the resulting image. + */ + crop(box: Box): Image; + crop(x: number, y: number, width: number, height: number): Image; + /** + * Creates a mask by testing if pixels (RGB, HSV, ...) are between lower and upper. Formally speaking: + * lower1 ≤ pixel1 ≤ upper1 + * ∧ lower2 ≤ pixel2 ≤ upper2 + * ∧ lower3 ≤ pixel3 ≤ upper3 + */ + inRange(lower1: number, lower2: number, lower3: number, upper1: number, upper2: number, upper3: number): Image; + /** + * Only available for grayscale images. Returns the histogram in an array of length 256, where each entry represents the fraction (0.0 to 1.0) of that color in the image. + * The mask parameter is optional and must be a monochrome image of same width and height; only pixels where mask is 0 will be counted. + */ + histogram(mask?: Image): Image; + /** + * Computes the horizontal or vertical projection of an 1bpp or 8bpp image. + */ + projection(mode: 'horizontal' | 'vertical'): number[]; + /** + * Sets the specified value to each pixel set in the mask. + */ + setMasked(mask: Image, value: number): Image; + /** + * Available for grayscale and color images. Channelwise maps each pixel of image using mapping, which must be an array of length 256 with integer values between 0 and 255. + * !!! !!! Note: this function actually changes the image! + * The mask parameter is optional and must be a monochrome image of same width and height; only pixels where mask is 0 will be modified. + */ + applyCurve(mapping: number[], mask?: Image): this; + /** + * Applies a rank (0.0 ... 1.0) filter of the specified width + * and height (think of it as radius) to this image + * and returns the result. + * If you set rank to 0.5 you'll get a Median Filter. + * Note that this type of filter works best with odd sizes like 3 or 5. + */ + rankFilter(width: number, height: number, rank: number): Image; + /** + * Color image quantization using an octree based algorithm. + * colors must be between 2 and 256. + * Note that support for the resulting palette image is highly experimental at this point; + * only toGray() and toBuffer('png') are guaranteed to work. + */ + octreeColorQuant(colors: number): Image; + /** + * Color image quantization using median cut algorithm. + * colors must be between 2 and 256. + * Note that support for the resulting palette image is highly experimental at this point; + * only toGray() and toBuffer('png') are guaranteed to work. + */ + medianCutQuant(colors: number): Image; + /** + * Converts a grayscale image to monochrome using a global threshold. value must be between 0 and 255. + */ + threshold(value: number): Image; + /** + * Converts an image to grayscale using default settings. Can be used to convert monochrome images back to grayscale. + */ + toGray(): Image; + /** + * Converts an RGB image to grayscale using the specified widths for each channel. + */ + toGray(redWeight: number, greenWeight: number, blueWeight: number): Image; + /** + * Converts an RGB image to grayscale by selecting either the 'min' or 'max' channel. + * This can act as a simple color filter: 'max' maps colored pixels towards white, + * while 'min' maps colored pixels towards black. + */ + toGray(selector: 'min' | 'max'): Image; + /** + * Converts a grayscale image to a color image. + */ + toColor(): Image; + /** + * Converts from RGB to HSV color space. HSV has the following ranges: + * Hue: [0 .. 239] + * Saturation: [0 .. 255] + * Value: [0 .. 255] + */ + toHSV(): Image; + /** + * Converts from HSV to RGB color space. + */ + toRGB(): Image; + /** + * Applies an Erode Filter and returns the result. + */ + erode(width: number, height: number): Image; + /** + * Applies a Dilate Filter and returns the result. + */ + dilate(width: number, height: number): Image; + /** + * Applies an Open Filter and returns the result. + */ + open(width: number, height: number): Image; + /** + * Applies a Close Filter and returns the result. + */ + close(width: number, height: number): Image; + /** + * Applies morphological thinning of type (fg or bg) with the specified connectivitiy (4 or 8) and maxIterations (0 to iterate until complete). + */ + thin(type: 'fg' | 'bg', connectivity: number, maxIterations: number): Image; + /** + * Scales an 8bpp image for maximum dynamic range. scale must be either log or linear. + */ + maxDynamicRange(scale: 'log' | 'linear'): Image; + /** + * Applies Otsu's Method for computing the threshold of a grayscale image. + * It computes a threshold for each tile of the specified size and performs the threshold operation, + * resulting in a binary image for each tile. These are stitched into the final result. + * The smooth size controls the a convolution kernel applied to threshold array (use 0 for no smoothing). + * The score factor controls the fraction of the max. Otsu score (typically 0.1; use 0.0 for standard Otsu). + */ + otsuAdaptiveThreshold(tileWidth: number, tileHeight: number, smoothWidth: number, smoothHeight: number, scoreFactor: number): Image; + /** + * Detects Line Segments with the specified accuracy (3 is a good start). The number of found line segments can be limited using maxLineSegments (0 is unlimited). + */ + lineSegments(accuracy: number, maxLineSegments: number, useWeightedMeanShift: boolean): Segment[]; + /** + * Only available for monochrome images. Tries to find the skew of this image. The resulting angle is in degree. The confidence is between 0.0 and 1.0. + */ + findSkew(): Skew; + /** + * Only available for monochrome images. Tries to extract connected components (think of flood fill). The connectivity can be specified as 4 or 8 directions. + */ + connectedComponents(connectivity: 4 | 8): Component[]; + /** + * The Distance Function works on 1bpp images. It labels each pixel with the largest distance between this and any other pixel in its connected component. The connectivity is either 4 or 8. + */ + distanceFunction(connectivity: 4 | 8): Image; + /** + * !!! Note: this function actually changes the image! + * Fills a specified rectangle with white. + */ + clearBox(box: Box): this; + clearBox(x: number, y: number, width: number, height: number): this; + /** + * !!! Note: this function actually changes the image! + * Draws a filled rectangle to this image with the specified value. Works for 8bpp and 1bpp images. + */ + fillBox(box: Box, value: number): this; + fillBox(x: number, y: number, width: number, height: number, value: number): this; + /** + * !!! Note: this function actually changes the image! + * Draws a filled rectangle to this image in the specified color with an optional blending parameter (0.0: transparent; 1.0: no transparency). + */ + fillBox(box: Box, r: number, g: number, b: number, fraction?: number): this; + fillBox(x: number, y: number, width: number, height: number, r: number, g: number, b: number, fraction?: number): this; + /** + * !!! Note: this function actually changes the image! + * Draws a rectangle to this image with the specified border. The possible pixel manipulating operations are set, clear and flip. + */ + drawBox(box: Box, borderWidth: number, operation: 'set' | 'clear' | 'flip'): this; + drawBox(x: number, y: number, width: number, height: number, borderWidth: number, operation: 'set' | 'clear' | 'flip'): this; + /** + * !!! Note: this function actually changes the image! + * Draws a rectangle to this image with the specified border in the specified color with an optional blending parameter (0.0: transparent; 1.0: no transparency). + */ + drawBox(box: Box, borderWidth: number, red: number, green: number, blue: number, frac?: number): this; + drawBox(x: number, y: number, width: number, height: number, borderWidth: number, red: number, green: number, blue: number, frac?: number): this; + /** + * !!! Note: this function actually changes the image! + * Draws a line between p1 and p2 to this image with the specified line width. The possible pixel manipulating operations are set, clear and flip. + */ + drawLine(p1: Point, p2: Point, width: number, operation: 'set' | 'clear' | 'flip'): this; + /** + * !!! Note: this function actually changes the image! + * Draws a line between p1 and p2 to this image with the specified line width in the specified color with an optional blending parameter (0.0: transparent; 1.0: no transparency). + */ + drawLine(p1: Point, p2: Point, width: number, red: number, green: number, blue: number, frac?: number): this; + /** + * !!! Note: this function actually changes the image! + * Draws an image to this image with the specified destination box. + */ + drawImage(image: Image, box: Box): this; + drawImage(image: Image, x: number, y: number, width: number, height: number): this; + /** + * Converts the Image in the specified format to a buffer. + * Specifying raw returns the raw image data as buffer. + * For color images, the result contains three bytes per pixel in the order R, G, B; + * for grayscale and monochrome images, it contains one byte per pixel. + * Specifying png returns a PNG encoded image as buffer. + * Specifying jpg returns a JPG encoded image as buffer. + */ + toBuffer(format?: 'raw' | 'png' | 'jpg'): Buffer; +} + +export interface Rect { + x: number; + y: number; + width: number; + height: number; +} + +export interface Region { + box: Box; + text: string; + confidence: number; +} + +export type Paragaph = Region; + +export interface Textline { + box: Box; +} + +export type Word = Region; + +export interface Choice { + text: string; + confidence: number; +} + +export interface Symbol extends Region { + choices: Choice[]; +} + +export type Text = Choice; + +/** + * A Tesseract object represents an optical character recognition engine, that reads text using Tesseract from an image. + * Tesseract supports many langauges and fonts (see Tesseract/Downloads). + * New language files have to be installed in node-dv/tessdata. + */ +export class Tesseract { + /** + * Creates a Tesseract engine with language set to english. + */ + constructor(); + constructor(datapath: string); + /** + * Creates a Tesseract engine with the specified language. + */ + constructor(lang: string, image: Image); + /** + * Creates a Tesseract engine with the specified language and image. + */ + constructor(datapath: string, lang: string, image: Image); + + /** + * Accessor for the input image. + */ + image: Image; + /** + * Accessor for the rectangle that specifies a "visible" area on the image. + */ + rectangle: Rect; + /** + * Accessor for the page segmentation mode. + */ + pageSegMode: 'osd_only' | 'auto_osd' | 'auto_only' | 'auto' + | 'single_column' | 'single_block_vert_text' | 'single_block' + | 'single_line' | 'single_word' | 'circle_word' | 'single_char' + | 'sparse_text' | 'sparse_text_osd'; + [key: string]: unknown; + + /** + * Clears the tesseract image and its last results. + */ + clear(): void; + /** + * Clears all adaptive classifiers (use this when results vary during scanning). + */ + clearAdaptiveClassifier(): void; + /** + * Returns the binarized image Tesseract uses for its recognition. + */ + thresholdImage(): Image; + /** + * Returns an array of objects, You can omit text information by setting recognize = false, which is considerably faster. + */ + findRegions(recognize: boolean): Region[]; + /** + * Returns an array of objects, You can omit text information by setting recognize = false, which is considerably faster. + */ + findParagraphs(recognize: boolean): Paragaph[]; + /** + * Returns an array of objects, You can omit text information by setting recognize = false, which is considerably faster. + */ + findTextLines(recognize: boolean): Textline[]; + /** + * Returns an array of objects, You can omit text information by setting recognize = false, which is considerably faster. + */ + findWords(recognize: boolean): Word[]; + /** + * Returns an array of objects, You can omit text information by setting recognize = false, which is considerably faster. + */ + findSymbols(recognize: boolean): symbol[]; + /** + * Returns text in the specified format. Valid formats are: plain, unlv. + */ + findText(format: 'plain' | 'unlv', withConfidence?: boolean): string; + findText(format: 'hocr' | 'box', pageNumber: number): string; +} + +export interface Barcodeformat { + QR_CODE: boolean; + DATA_MATRIX: boolean; + PDF_417: boolean; + UPC_E: boolean; + UPC_A: boolean; + EAN_8: boolean; + EAN_13: boolean; + CODE_128: boolean; + CODE_39: boolean; + ITF: boolean; + AZTEC: boolean; +} + +export interface BarCode { + type: string; + data: string; + buffer: Buffer; + points: Point[]; +} + +/** + * A ZXing object represents a barcode reader. By default it attempts to decode all barcode formats that ZXing supports. + */ +export class ZXing { + constructor(image?: Image); + + /** + * Accessor for the input image this barcode reader operates on. + */ + image: Image; + /** + * List of barcodes the reader tries to find. It's specified as an object and missing properties account as false + */ + formats: Barcodeformat; + /** + * If try harder is enabled, the barcode reader spends more time trying to find a barcode (optimize for accuracy, not speed). + */ + tryHarder: boolean; + /** + * Returns the first barcode found as an object with the following format: + */ + findCode(): BarCode; + /** + * enotes the barcodes type. + */ + readonly type: 'None' | 'QR_CODE' | 'DATA_MATRIX' | 'PDF_417' | 'UPC_E' | 'UPC_A' | 'EAN_8' | 'EAN_13' | 'CODE_128' | 'CODE_39' | 'ITF' | 'AZTEC'; + /** + * denotes the stringified data read from the barcode. + */ + readonly data: string; + /** + * denotes the decoded binary data of the barcode before conversion into another character encoding. + */ + readonly buffer: Buffer; + /** + * denotes the points in pixels which were used by the barcode reader to detect the barcode. + */ + readonly points: Point[]; +} diff --git a/types/dv/tsconfig.json b/types/dv/tsconfig.json new file mode 100644 index 0000000000..ad0aaa212b --- /dev/null +++ b/types/dv/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", + "dv-tests.ts" + ] +} \ No newline at end of file diff --git a/types/dv/tslint.json b/types/dv/tslint.json new file mode 100644 index 0000000000..8765f2428f --- /dev/null +++ b/types/dv/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false + } +} \ No newline at end of file diff --git a/types/echarts/index.d.ts b/types/echarts/index.d.ts index 5d40c148f6..873060c5f4 100644 --- a/types/echarts/index.d.ts +++ b/types/echarts/index.d.ts @@ -6,6 +6,7 @@ // Ovilia // Roman // Bilal +// TMTron // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/echarts/options/data-zoom.d.ts b/types/echarts/options/data-zoom.d.ts index 2ed18582ef..fa57f73a14 100644 --- a/types/echarts/options/data-zoom.d.ts +++ b/types/echarts/options/data-zoom.d.ts @@ -66,7 +66,7 @@ declare namespace echarts { show?: boolean; backgroundColor?: string; dataBackground?: object; - fillColor?: string; + fillerColor?: string; borderColor?: string; handleIcon?: string; handleSize?: number; diff --git a/types/electron-store/electron-store-tests.ts b/types/electron-store/electron-store-tests.ts index f27cd6aca3..318af19f5c 100644 --- a/types/electron-store/electron-store-tests.ts +++ b/types/electron-store/electron-store-tests.ts @@ -52,3 +52,7 @@ typedElectronStore.set({ enabled: true, interval: 10000, }); + +const offDidChange = typedElectronStore.onDidChange("enabled", (n: boolean | undefined, p: boolean | undefined) => {}); + +offDidChange(); diff --git a/types/electron-store/index.d.ts b/types/electron-store/index.d.ts index 66e579b392..721386de2f 100644 --- a/types/electron-store/index.d.ts +++ b/types/electron-store/index.d.ts @@ -8,6 +8,8 @@ /// +import EventEmitter = require("events"); + type JSONValue = string | number | boolean | JSONObject | JSONArray; interface JSONObject { @@ -79,12 +81,12 @@ declare class ElectronStore implements Iterable<[string, JSONValue]> { */ onDidChange( key: K, - callback: (newValue: T[K], oldValue: T[K]) => void - ): void; + callback: (newValue: T[K] | undefined, oldValue: T[K] | undefined) => void + ): () => EventEmitter; onDidChange( key: string, - callback: (newValue: JSONValue, oldValue: JSONValue) => void - ): void; + callback: (newValue: JSONValue | undefined, oldValue: JSONValue | undefined) => void + ): () => EventEmitter; /** * Get the item count. diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index d0f9896eb9..d7aaa35b36 100755 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -498,7 +498,6 @@ export namespace Ember { // TODO: replace with an es6 reexport when declare module 'ember' is removed /** * Copy properties from a source object to a target object. - * @deprecated Use Object.assign */ const assign: typeof EmberPolyfillsNs.assign; /** diff --git a/types/globby/package.json b/types/ember/v1/package.json similarity index 63% rename from types/globby/package.json rename to types/ember/v1/package.json index 136d4694e9..77c0c562ac 100644 --- a/types/globby/package.json +++ b/types/ember/v1/package.json @@ -1,6 +1,6 @@ { "private": true, "dependencies": { - "fast-glob": "^2.0.2" + "handlebars": "^4.1.0" } } diff --git a/types/ember/v2/index.d.ts b/types/ember/v2/index.d.ts index 54b6d2e4a9..783fcca14c 100755 --- a/types/ember/v2/index.d.ts +++ b/types/ember/v2/index.d.ts @@ -12,7 +12,6 @@ // TypeScript Version: 2.4 /// -/// declare module 'ember' { // Capitalization is intentional: this makes it much easier to re-export RSVP on @@ -274,6 +273,12 @@ declare module 'ember' { triggerAction(opts: TriggerActionOptions): boolean; } + interface DeprecationOptions { + id: string; + until: string; + url?: string; + } + export namespace Ember { interface FunctionPrototypeExtensions { /** @@ -2415,6 +2420,7 @@ declare module 'ember' { function print(ast: any): void; const logger: typeof Ember.Logger; function log(level: string, str: string): void; + function registerHelper(name: string, helper: any): void; } namespace String { function camelize(str: string): string; @@ -2574,14 +2580,14 @@ declare module 'ember' { */ deprecatingAlias( dependentKey: string, - options: { id: string; until: string } + options: DeprecationOptions ): ComputedProperty; /** * @deprecated Missing deprecation options: https://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options */ deprecatingAlias( dependentKey: string, - options?: { id?: string; until?: string } + options?: Partial ): ComputedProperty; /** * A computed property that returns the sum of the values @@ -2977,7 +2983,7 @@ declare module 'ember' { function deprecate( message: string, test: boolean, - options: { id: string; until: string } + options: DeprecationOptions ): any; /** * @deprecated Missing deprecation options: https://emberjs.com/deprecations/v2.x/#toc_ember-debug-function-options @@ -2985,7 +2991,7 @@ declare module 'ember' { function deprecate( message: string, test: boolean, - options?: { id?: string; until?: string } + options?: Partial ): any; /** * Define an assertion that will throw an exception if the condition is not met. @@ -3012,7 +3018,7 @@ declare module 'ember' { */ function deprecateFunc any)>( message: string, - options: { id: string; until: string }, + options: DeprecationOptions, func: Func ): Func; /** @@ -3131,7 +3137,7 @@ declare module 'ember' { function isPresent(obj: any): boolean; /** * Merge the contents of two objects together into the first object. - * @deprecated Use Object.assign + * @deprecated Use Ember.assign */ function merge(original: T, updates: U): T & U; /** @@ -3284,7 +3290,6 @@ declare module 'ember' { function typeOf(item: any): string; /** * Copy properties from a source object to a target object. - * @deprecated Use Object.assign */ function assign(target: T, source: U): T & U; function assign(target: T, source1: U, source2: V): T & U & V; diff --git a/types/ember/v2/package.json b/types/ember/v2/package.json new file mode 100644 index 0000000000..77c0c562ac --- /dev/null +++ b/types/ember/v2/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "handlebars": "^4.1.0" + } +} diff --git a/types/ember/v2/test/ember-tests.ts b/types/ember/v2/test/ember-tests.ts index c049512eb0..892c9ed9a8 100755 --- a/types/ember/v2/test/ember-tests.ts +++ b/types/ember/v2/test/ember-tests.ts @@ -92,10 +92,10 @@ App.userController = Ember.Object.create({ }), }); -Handlebars.registerHelper( +Ember.Handlebars.registerHelper( 'highlight', (property: string, options: any) => - new Handlebars.SafeString('' + 'some value' + '') + new Ember.Handlebars.SafeString('' + 'some value' + '') ); const coolView = App.CoolView.create(); diff --git a/types/ember/v2/test/utils.ts b/types/ember/v2/test/utils.ts index d729d472b8..72d55184ab 100755 --- a/types/ember/v2/test/utils.ts +++ b/types/ember/v2/test/utils.ts @@ -50,6 +50,14 @@ function testDeprecateFunc() { assertType(oldMethod('first', 123)); } +function testDeprecate() { + Ember.deprecate('This has been deprecated', false, { + id: 'some.id', + until: '1.0.0', + url: 'http://www.emberjs.com' + }); +} + function testDefineProperty() { const contact = {}; diff --git a/types/ember__application/deprecations.d.ts b/types/ember__application/deprecations.d.ts index 8509e2f69d..ddc5af5019 100644 --- a/types/ember__application/deprecations.d.ts +++ b/types/ember__application/deprecations.d.ts @@ -1,3 +1,10 @@ +// tslint:disable-next-line:strict-export-declare-modifiers +interface DeprecationOptions { + id: string; + until: string; + url?: string; +} + /** * Display a deprecation warning with the provided message and a stack trace * (Chrome and Firefox only). @@ -5,7 +12,7 @@ export function deprecate( message: string, test: boolean, - options: { id: string; until: string } + options: DeprecationOptions ): any; /** @@ -13,6 +20,6 @@ export function deprecate( */ export function deprecateFunc any)>( message: string, - options: { id: string; until: string }, + options: DeprecationOptions, func: Func ): Func; diff --git a/types/ember__application/test/deprecations.ts b/types/ember__application/test/deprecations.ts index 30d1e8a075..c5db468535 100644 --- a/types/ember__application/test/deprecations.ts +++ b/types/ember__application/test/deprecations.ts @@ -1,8 +1,13 @@ import { deprecate, deprecateFunc } from '@ember/application/deprecations'; +deprecate('this is no longer advised', false, { + id: 'no-longer-advised', + until: 'v4.0' +}); deprecate('this is no longer advised', false, { id: 'no-longer-advised', - until: 'v4.0' + until: 'v4.0', + url: 'https://emberjs.com' }); deprecate('this is no longer advised', false); // $ExpectError diff --git a/types/ember__object/proxy.d.ts b/types/ember__object/proxy.d.ts index 841b211e49..38c690fe72 100644 --- a/types/ember__object/proxy.d.ts +++ b/types/ember__object/proxy.d.ts @@ -1,12 +1,32 @@ import EmberObject from "@ember/object"; +import { + UnwrapComputedPropertyGetter, + UnwrapComputedPropertyGetters +} from "@ember/object/-private/types"; /** * `Ember.ObjectProxy` forwards all properties not defined by the proxy itself * to a proxied `content` object. */ -export default class ObjectProxy extends EmberObject { +export default class ObjectProxy extends EmberObject { /** * The object whose properties will be forwarded. */ - content: object; + content: T | undefined; + + get(key: K): UnwrapComputedPropertyGetter; + get(key: K): UnwrapComputedPropertyGetter | undefined; + + getProperties( + list: K[] + ): Pick, K>; + getProperties( + ...list: K[] + ): Pick, K>; + getProperties( + list: K[] + ): Pick>, K>; + getProperties( + ...list: K[] + ): Pick>, K>; } diff --git a/types/ember__object/test/proxy.ts b/types/ember__object/test/proxy.ts new file mode 100644 index 0000000000..bacfd013f1 --- /dev/null +++ b/types/ember__object/test/proxy.ts @@ -0,0 +1,38 @@ +import ObjectProxy from "@ember/object/proxy"; + +interface Book { + title: string; + subtitle: string; + chapters: Array<{ title: string }>; +} + +class DefaultProxy extends ObjectProxy {} +DefaultProxy.create().content; // $ExpectType object | undefined + +class BookProxy extends ObjectProxy { + private readonly baz = 'baz'; + + getTitle() { + return this.get('title'); + } + + getPropertiesTitleSubtitle() { + return this.getProperties('title', 'subtitle'); + } +} + +const book = BookProxy.create(); +book.content; // $ExpectType Book | undefined + +book.get("unknownProperty"); // $ExpectError +book.get("title"); // $ExpectType string | undefined +book.getTitle(); // $ExpectType string | undefined + +book.getProperties("title", "unknownProperty"); // $ExpectError +book.getProperties("title", "subtitle"); // $ExpectType Pick>, "title" | "subtitle"> +book.getPropertiesTitleSubtitle(); // $ExpectType Pick>, "title" | "subtitle"> + +book.getProperties(["subtitle", "chapters"]); // $ExpectType Pick>, "subtitle" | "chapters"> +book.getProperties(["title", "unknownProperty"]); // $ExpectError + +book.get("baz"); // $ExpectError diff --git a/types/ember__object/tsconfig.json b/types/ember__object/tsconfig.json index 5ed61a24d3..deeb128e7b 100644 --- a/types/ember__object/tsconfig.json +++ b/types/ember__object/tsconfig.json @@ -49,6 +49,7 @@ "test/extend.ts", "test/object.ts", "test/observable.ts", + "test/proxy.ts", "test/reopen.ts" ] } diff --git a/types/ember__polyfills/index.d.ts b/types/ember__polyfills/index.d.ts index e5ace0fe2e..01820351e5 100644 --- a/types/ember__polyfills/index.d.ts +++ b/types/ember__polyfills/index.d.ts @@ -8,7 +8,6 @@ import { Mix, Mix3, Mix4 } from './types'; /** * Copy properties from a source object to a target object. - * @deprecated Use Object.assign */ export function assign(target: T, source: U): Mix; export function assign(target: T, source1: U, source2: V): Mix3; @@ -17,6 +16,6 @@ export function assign(target: object, ...sources: object[]): any; /** * Merge the contents of two objects together into the first object. - * @deprecated Use Object.assign + * @deprecated Use Ember.assign */ export function merge(original: T, updates: U): Mix; diff --git a/types/ember__runloop/-private/backburner.d.ts b/types/ember__runloop/-private/backburner.d.ts new file mode 100644 index 0000000000..98e01b230b --- /dev/null +++ b/types/ember__runloop/-private/backburner.d.ts @@ -0,0 +1,37 @@ +export interface QueueItem { + method: string; + target: object; + args: object[]; + stack: string | undefined; +} + +export interface DeferredActionQueues { + [index: string]: any; + queues: object; + schedule( + queueName: string, + target: any, + method: any, + args: any, + onceFlag: boolean, + stack: any + ): any; + flush(fromAutorun: boolean): any; +} + +export interface DebugInfo { + autorun: Error | undefined | null; + counters: object; + timers: QueueItem[]; + instanceStack: DeferredActionQueues[]; +} + +export interface Backburner { + join(...args: any[]): void; + on(...args: any[]): void; + scheduleOnce(...args: any[]): void; + schedule(queueName: string, target: object | null, method: () => void | string): void; + ensureInstance(): void; + DEBUG: boolean; + getDebugInfo(): DebugInfo; +} diff --git a/types/ember__runloop/ember__runloop-tests.ts b/types/ember__runloop/ember__runloop-tests.ts index cf9cfd7db1..37d1fc18e4 100644 --- a/types/ember__runloop/ember__runloop-tests.ts +++ b/types/ember__runloop/ember__runloop-tests.ts @@ -1,9 +1,19 @@ import { run } from '@ember/runloop'; import EmberObject from '@ember/object'; +import { Backburner, DebugInfo, QueueItem, DeferredActionQueues } from '@ember/runloop/-private/backburner'; +run; // $ExpectType RunNamespace run.queues; // $ExpectType EmberRunQueues[] const queues: string[] = run.queues; +// It will be the responsibility of each consuming package that needs access to the backburner property +// to merge the private types in the public API. +declare module '@ember/runloop' { + interface RunNamespace { + backburner: Backburner; + } +} + function testRun() { run(() => { // $ExpectType number // code to be executed within a RunLoop @@ -198,3 +208,9 @@ function testThrottle() { run.throttle(runIt, 150); run.throttle(myContext, runIt, 150); } + +function testBackburner() { + const debugInfo: DebugInfo = run.backburner.getDebugInfo(); + const queueItems: QueueItem[] = debugInfo.timers; + const deferredActionQueues: DeferredActionQueues[] = debugInfo.instanceStack; +} diff --git a/types/ember__runloop/index.d.ts b/types/ember__runloop/index.d.ts index 79b3b5973b..9f1fd6c260 100644 --- a/types/ember__runloop/index.d.ts +++ b/types/ember__runloop/index.d.ts @@ -1,320 +1,322 @@ // Type definitions for non-npm package @ember/runloop 3.0 // Project: https://emberjs.com/api/ember/3.4/modules/@ember%2Frunloop // Definitions by: Mike North +// Steve Calvert // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 import { RunMethod, EmberRunQueues } from "@ember/runloop/-private/types"; import { EmberRunTimer } from "@ember/runloop/types"; +import '@ember/runloop/-private/backburner'; -// tslint:disable-next-line:strict-export-declare-modifiers -export const run: { - /** - * Runs the passed target and method inside of a RunLoop, ensuring any - * deferred actions including bindings and views updates are flushed at the - * end. - */ - (method: (...args: any[]) => Ret): Ret; - (target: Target, method: RunMethod): Ret; - /** - * If no run-loop is present, it creates a new one. If a run loop is - * present it will queue itself to run on the existing run-loops action - * queue. - */ - join(method: (...args: any[]) => Ret, ...args: any[]): Ret | undefined; - join( - target: Target, - method: RunMethod, - ...args: any[] - ): Ret | undefined; - /** - * Allows you to specify which context to call the specified function in while - * adding the execution of that function to the Ember run loop. This ability - * makes this method a great way to asynchronously integrate third-party libraries - * into your Ember application. - */ - bind( - target: Target, - method: RunMethod, - ...args: any[] - ): (...args: any[]) => Ret; - /** - * Begins a new RunLoop. Any deferred actions invoked after the begin will - * be buffered until you invoke a matching call to `run.end()`. This is - * a lower-level way to use a RunLoop instead of using `run()`. - */ - begin(): void; - /** - * Ends a RunLoop. This must be called sometime after you call - * `run.begin()` to flush any deferred actions. This is a lower-level way - * to use a RunLoop instead of using `run()`. - */ - end(): void; - /** - * Adds the passed target/method and any optional arguments to the named - * queue to be executed at the end of the RunLoop. If you have not already - * started a RunLoop when calling this method one will be started for you - * automatically. - */ - schedule( - queue: EmberRunQueues, - target: Target, - method: RunMethod, - ...args: any[] - ): EmberRunTimer; - schedule( - queue: EmberRunQueues, - method: (args: any[]) => any, - ...args: any[] - ): EmberRunTimer; - /** - * Invokes the passed target/method and optional arguments after a specified - * period of time. The last parameter of this method must always be a number - * of milliseconds. - */ - later(method: (...args: any[]) => any, wait: number): EmberRunTimer; - later( - target: Target, - method: RunMethod, - wait: number - ): EmberRunTimer; - later( - target: Target, - method: RunMethod, - arg0: any, - wait: number - ): EmberRunTimer; - later( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - wait: number - ): EmberRunTimer; - later( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - wait: number - ): EmberRunTimer; - later( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - arg3: any, - wait: number - ): EmberRunTimer; - later( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - arg3: any, - arg4: any, - wait: number - ): EmberRunTimer; - later( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - arg3: any, - arg4: any, - arg5: any, - wait: number - ): EmberRunTimer; - /** - * Schedule a function to run one time during the current RunLoop. This is equivalent - * to calling `scheduleOnce` with the "actions" queue. - */ - once( - target: Target, - method: RunMethod, - ...args: any[] - ): EmberRunTimer; - /** - * Schedules a function to run one time in a given queue of the current RunLoop. - * Calling this method with the same queue/target/method combination will have - * no effect (past the initial call). - */ - scheduleOnce( - queue: EmberRunQueues, - target: Target, - method: RunMethod, - ...args: any[] - ): EmberRunTimer; - /** - * Schedules an item to run from within a separate run loop, after - * control has been returned to the system. This is equivalent to calling - * `run.later` with a wait time of 1ms. - */ - next( - target: Target, - method: RunMethod, - ...args: any[] - ): EmberRunTimer; - /** - * Cancels a scheduled item. Must be a value returned by `run.later()`, - * `run.once()`, `run.scheduleOnce()`, `run.next()`, `run.debounce()`, or - * `run.throttle()`. - */ - cancel(timer: EmberRunTimer): boolean; - /** - * Delay calling the target method until the debounce period has elapsed - * with no additional debounce calls. If `debounce` is called again before - * the specified time has elapsed, the timer is reset and the entire period - * must pass again before the target method is called. - */ - debounce( - method: (...args: any[]) => any, - wait: number, - immediate?: boolean - ): EmberRunTimer; - debounce( - target: Target, - method: RunMethod, - wait: number, - immediate?: boolean - ): EmberRunTimer; - debounce( - target: Target, - method: RunMethod, - arg0: any, - wait: number, - immediate?: boolean - ): EmberRunTimer; - debounce( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - wait: number, - immediate?: boolean - ): EmberRunTimer; - debounce( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - wait: number, - immediate?: boolean - ): EmberRunTimer; - debounce( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - arg3: any, - wait: number, - immediate?: boolean - ): EmberRunTimer; - debounce( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - arg3: any, - arg4: any, - wait: number, - immediate?: boolean - ): EmberRunTimer; - debounce( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - arg3: any, - arg4: any, - arg5: any, - wait: number, - immediate?: boolean - ): EmberRunTimer; - /** - * Ensure that the target method is never called more frequently than - * the specified spacing period. The target method is called immediately. - */ - throttle( - method: (...args: any[]) => any, - spacing: number, - immediate?: boolean - ): EmberRunTimer; - throttle( - target: Target, - method: RunMethod, - spacing: number, - immediate?: boolean - ): EmberRunTimer; - throttle( - target: Target, - method: RunMethod, - arg0: any, - spacing: number, - immediate?: boolean - ): EmberRunTimer; - throttle( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - spacing: number, - immediate?: boolean - ): EmberRunTimer; - throttle( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - spacing: number, - immediate?: boolean - ): EmberRunTimer; - throttle( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - arg3: any, - spacing: number, - immediate?: boolean - ): EmberRunTimer; - throttle( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - arg3: any, - arg4: any, - spacing: number, - immediate?: boolean - ): EmberRunTimer; - throttle( - target: Target, - method: RunMethod, - arg0: any, - arg1: any, - arg2: any, - arg3: any, - arg4: any, - arg5: any, - spacing: number, - immediate?: boolean - ): EmberRunTimer; +export interface RunNamespace { + /** + * Runs the passed target and method inside of a RunLoop, ensuring any + * deferred actions including bindings and views updates are flushed at the + * end. + */ + (method: (...args: any[]) => Ret): Ret; + (target: Target, method: RunMethod): Ret; + /** + * If no run-loop is present, it creates a new one. If a run loop is + * present it will queue itself to run on the existing run-loops action + * queue. + */ + join(method: (...args: any[]) => Ret, ...args: any[]): Ret | undefined; + join( + target: Target, + method: RunMethod, + ...args: any[] + ): Ret | undefined; + /** + * Allows you to specify which context to call the specified function in while + * adding the execution of that function to the Ember run loop. This ability + * makes this method a great way to asynchronously integrate third-party libraries + * into your Ember application. + */ + bind( + target: Target, + method: RunMethod, + ...args: any[] + ): (...args: any[]) => Ret; + /** + * Begins a new RunLoop. Any deferred actions invoked after the begin will + * be buffered until you invoke a matching call to `run.end()`. This is + * a lower-level way to use a RunLoop instead of using `run()`. + */ + begin(): void; + /** + * Ends a RunLoop. This must be called sometime after you call + * `run.begin()` to flush any deferred actions. This is a lower-level way + * to use a RunLoop instead of using `run()`. + */ + end(): void; + /** + * Adds the passed target/method and any optional arguments to the named + * queue to be executed at the end of the RunLoop. If you have not already + * started a RunLoop when calling this method one will be started for you + * automatically. + */ + schedule( + queue: EmberRunQueues, + target: Target, + method: RunMethod, + ...args: any[] + ): EmberRunTimer; + schedule( + queue: EmberRunQueues, + method: (args: any[]) => any, + ...args: any[] + ): EmberRunTimer; + /** + * Invokes the passed target/method and optional arguments after a specified + * period of time. The last parameter of this method must always be a number + * of milliseconds. + */ + later(method: (...args: any[]) => any, wait: number): EmberRunTimer; + later( + target: Target, + method: RunMethod, + wait: number + ): EmberRunTimer; + later( + target: Target, + method: RunMethod, + arg0: any, + wait: number + ): EmberRunTimer; + later( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + wait: number + ): EmberRunTimer; + later( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + wait: number + ): EmberRunTimer; + later( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + arg3: any, + wait: number + ): EmberRunTimer; + later( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + arg3: any, + arg4: any, + wait: number + ): EmberRunTimer; + later( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + arg3: any, + arg4: any, + arg5: any, + wait: number + ): EmberRunTimer; + /** + * Schedule a function to run one time during the current RunLoop. This is equivalent + * to calling `scheduleOnce` with the "actions" queue. + */ + once( + target: Target, + method: RunMethod, + ...args: any[] + ): EmberRunTimer; + /** + * Schedules a function to run one time in a given queue of the current RunLoop. + * Calling this method with the same queue/target/method combination will have + * no effect (past the initial call). + */ + scheduleOnce( + queue: EmberRunQueues, + target: Target, + method: RunMethod, + ...args: any[] + ): EmberRunTimer; + /** + * Schedules an item to run from within a separate run loop, after + * control has been returned to the system. This is equivalent to calling + * `run.later` with a wait time of 1ms. + */ + next( + target: Target, + method: RunMethod, + ...args: any[] + ): EmberRunTimer; + /** + * Cancels a scheduled item. Must be a value returned by `run.later()`, + * `run.once()`, `run.scheduleOnce()`, `run.next()`, `run.debounce()`, or + * `run.throttle()`. + */ + cancel(timer: EmberRunTimer): boolean; + /** + * Delay calling the target method until the debounce period has elapsed + * with no additional debounce calls. If `debounce` is called again before + * the specified time has elapsed, the timer is reset and the entire period + * must pass again before the target method is called. + */ + debounce( + method: (...args: any[]) => any, + wait: number, + immediate?: boolean + ): EmberRunTimer; + debounce( + target: Target, + method: RunMethod, + wait: number, + immediate?: boolean + ): EmberRunTimer; + debounce( + target: Target, + method: RunMethod, + arg0: any, + wait: number, + immediate?: boolean + ): EmberRunTimer; + debounce( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + wait: number, + immediate?: boolean + ): EmberRunTimer; + debounce( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + wait: number, + immediate?: boolean + ): EmberRunTimer; + debounce( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + arg3: any, + wait: number, + immediate?: boolean + ): EmberRunTimer; + debounce( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + arg3: any, + arg4: any, + wait: number, + immediate?: boolean + ): EmberRunTimer; + debounce( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + arg3: any, + arg4: any, + arg5: any, + wait: number, + immediate?: boolean + ): EmberRunTimer; + /** + * Ensure that the target method is never called more frequently than + * the specified spacing period. The target method is called immediately. + */ + throttle( + method: (...args: any[]) => any, + spacing: number, + immediate?: boolean + ): EmberRunTimer; + throttle( + target: Target, + method: RunMethod, + spacing: number, + immediate?: boolean + ): EmberRunTimer; + throttle( + target: Target, + method: RunMethod, + arg0: any, + spacing: number, + immediate?: boolean + ): EmberRunTimer; + throttle( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + spacing: number, + immediate?: boolean + ): EmberRunTimer; + throttle( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + spacing: number, + immediate?: boolean + ): EmberRunTimer; + throttle( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + arg3: any, + spacing: number, + immediate?: boolean + ): EmberRunTimer; + throttle( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + arg3: any, + arg4: any, + spacing: number, + immediate?: boolean + ): EmberRunTimer; + throttle( + target: Target, + method: RunMethod, + arg0: any, + arg1: any, + arg2: any, + arg3: any, + arg4: any, + arg5: any, + spacing: number, + immediate?: boolean + ): EmberRunTimer; - queues: EmberRunQueues[]; -}; + queues: EmberRunQueues[]; +} +export const run: RunNamespace; export const begin: typeof run.begin; export const bind: typeof run.bind; export const cancel: typeof run.cancel; diff --git a/types/ember__runloop/tsconfig.json b/types/ember__runloop/tsconfig.json index d06cb5216c..158a3d6459 100644 --- a/types/ember__runloop/tsconfig.json +++ b/types/ember__runloop/tsconfig.json @@ -28,6 +28,7 @@ "index.d.ts", "types.d.ts", "-private/types.d.ts", + "-private/backburner.d.ts", "ember__runloop-tests.ts" ] } diff --git a/types/env-paths/env-paths-tests.ts b/types/env-paths/env-paths-tests.ts deleted file mode 100644 index 9f360bbe41..0000000000 --- a/types/env-paths/env-paths-tests.ts +++ /dev/null @@ -1,10 +0,0 @@ -import envPaths = require('env-paths'); - -// $ExpectType Paths -envPaths('./'); -// $ExpectType Paths -envPaths('./', {suffix: 'test'}); -// $ExpectType Paths -envPaths('./', {suffix: false}); -// $ExpectType Paths -envPaths('./', {suffix: true}); diff --git a/types/env-paths/index.d.ts b/types/env-paths/index.d.ts deleted file mode 100644 index 8b594d8a61..0000000000 --- a/types/env-paths/index.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Type definitions for env-paths 1.0 -// Project: https://github.com/sindresorhus/env-paths -// Definitions by: Daniel Byrne -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = envPaths; - -declare function envPaths(name: string, opts?: { suffix: string | boolean }): envPaths.Paths; - -declare namespace envPaths { - interface Paths { - readonly data: string; - readonly config: string; - readonly cache: string; - readonly log: string; - readonly temp: string; - } -} diff --git a/types/expo-mixpanel-analytics/expo-mixpanel-analytics-tests.ts b/types/expo-mixpanel-analytics/expo-mixpanel-analytics-tests.ts new file mode 100644 index 0000000000..50dc0dffe4 --- /dev/null +++ b/types/expo-mixpanel-analytics/expo-mixpanel-analytics-tests.ts @@ -0,0 +1,31 @@ +import ExpoMixpanelAnalytics from 'expo-mixpanel-analytics'; + +const analytics = new ExpoMixpanelAnalytics('5224da5bbbed3fdeaad0911820f1bf2x'); + +analytics.identify("13793"); + +analytics.track("Signed Up", { "Referred By": "Friend" }); + +analytics.people_set({ + $first_name: "Joe", + $last_name: "Doe", + $email: "joe.doe@example.com", + $created: "2013-04-01T13:20:00", + $phone: "4805551212", + Address: "1313 Mockingbird Lane", + Birthday: "1948-01-01" +}); + +analytics.people_set_once({ "First login date": "2013-04-01T13:20:00" }); + +analytics.people_unset([ "Days Overdue" ]); + +analytics.people_increment({ "Coins Gathered": 12 }); + +analytics.people_append({ "Power Ups": "Bubble Lead" }); + +analytics.people_union({ "Items purchased": ["socks", "shirts"] }); + +analytics.people_delete_user(); + +analytics.reset(); diff --git a/types/expo-mixpanel-analytics/index.d.ts b/types/expo-mixpanel-analytics/index.d.ts new file mode 100644 index 0000000000..6b51a15585 --- /dev/null +++ b/types/expo-mixpanel-analytics/index.d.ts @@ -0,0 +1,26 @@ +// Type definitions for expo-mixpanel-analytics 0.0 +// Project: https://github.com/codekadiya/expo-mixpanel-analytics +// Definitions by: Martin Treurnicht +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +declare class ExpoMixpanelAnalytics { + constructor(token: string); + identify(userId: string): void; + track(name: string, props: Props): void; + people_set(props: Props): void; + people_set_once(props: Props): void; + people_unset(keys: string[]): void; + people_increment(props: Props): void; + people_append(props: Props): void; + people_union(props: Props): void; + people_delete_user(): void; + reset(): void; + token: string; +} + +interface Props { + [key: string]: T; +} + +export default ExpoMixpanelAnalytics; diff --git a/types/expo-mixpanel-analytics/tsconfig.json b/types/expo-mixpanel-analytics/tsconfig.json new file mode 100644 index 0000000000..57ee3b6a41 --- /dev/null +++ b/types/expo-mixpanel-analytics/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", + "expo-mixpanel-analytics-tests.ts" + ] +} diff --git a/types/globby/tslint.json b/types/expo-mixpanel-analytics/tslint.json similarity index 100% rename from types/globby/tslint.json rename to types/expo-mixpanel-analytics/tslint.json diff --git a/types/expo/expo-tests.tsx b/types/expo/expo-tests.tsx index ab34955ce2..c113b22576 100644 --- a/types/expo/expo-tests.tsx +++ b/types/expo/expo-tests.tsx @@ -49,6 +49,7 @@ import { registerRootComponent, ScreenOrientation, SecureStore, + SplashScreen, Svg, Updates } from 'expo'; @@ -1295,3 +1296,8 @@ async () => { response13.forEach((_: Contacts.Container) => _); }; // #endregion + +// #region SplashScreen +SplashScreen.hide(); +SplashScreen.preventAutoHide(); +// #endregion diff --git a/types/expo/index.d.ts b/types/expo/index.d.ts index 338a1c2989..4ca39cd202 100644 --- a/types/expo/index.d.ts +++ b/types/expo/index.d.ts @@ -16,6 +16,8 @@ // Bartosz Dotryw // Jason Killian // Satyajit Sahoo +// Vinit Sood +// Mattias Sämskar // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -200,6 +202,9 @@ export interface AppLoadingProps { /** If `startAsync` throws an error, it is caught and passed into the function provided to `onError`. */ onError?: (error: Error) => void; + + /** Whether to hide the native splash screen as soon as you unmount the AppLoading component. */ + autoHideSplash?: boolean; } /** @@ -2463,7 +2468,11 @@ export namespace ScreenOrientation { const Orientation: Orientations; + /** Deprecated in favour of ScreenOrientation.allowAsync. */ function allow(orientation: keyof Orientations): void; + + /** Allow a screen orientation. You can call this function multiple times with multiple orientations to allow multiple orientations. */ + function allowAsync(orientation: keyof Orientations): void; } /** @@ -2537,6 +2546,14 @@ export namespace Speech { function resume(): void; } +/** + * SplashScreen + */ +export namespace SplashScreen { + function hide(): void; + function preventAutoHide(): void; +} + /** * SQLite */ diff --git a/types/expo/v30/expo-tests.tsx b/types/expo/v30/expo-tests.tsx index 61467bd5d1..2d2b58c08f 100644 --- a/types/expo/v30/expo-tests.tsx +++ b/types/expo/v30/expo-tests.tsx @@ -41,7 +41,8 @@ import { Updates, MediaLibrary, Haptic, - Constants + Constants, + SplashScreen } from 'expo'; const reverseGeocode: Promise = Location.reverseGeocodeAsync({ @@ -951,3 +952,8 @@ async () => { const userAgent: string = await Constants.getWebViewUserAgentAsync(); }; // #endregion + +// #region SplashScreen +SplashScreen.hide(); +SplashScreen.preventAutoHide(); +// #endregion diff --git a/types/expo/v30/index.d.ts b/types/expo/v30/index.d.ts index f1b318414e..e6712b78ce 100644 --- a/types/expo/v30/index.d.ts +++ b/types/expo/v30/index.d.ts @@ -11,6 +11,7 @@ // Tina Roh // Nathan Phillip Brink // Martin Olsson +// Mattias Sämskar // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -1996,6 +1997,14 @@ export namespace Speech { function resume(): void; } +/** + * SplashScreen + */ +export namespace SplashScreen { + function hide(): void; + function preventAutoHide(): void; +} + /** * SQLite */ diff --git a/types/expo/v31/expo-tests.tsx b/types/expo/v31/expo-tests.tsx index 10045e57e6..c03764f56f 100644 --- a/types/expo/v31/expo-tests.tsx +++ b/types/expo/v31/expo-tests.tsx @@ -48,6 +48,7 @@ import { registerRootComponent, ScreenOrientation, SecureStore, + SplashScreen, Svg, Updates } from 'expo'; @@ -1261,3 +1262,8 @@ async () => { response13.forEach((_: Contacts.Container) => _); }; // #endregion + +// #region SplashScreen +SplashScreen.hide(); +SplashScreen.preventAutoHide(); +// #endregion diff --git a/types/expo/v31/index.d.ts b/types/expo/v31/index.d.ts index a3ce2caced..5b64de88e7 100644 --- a/types/expo/v31/index.d.ts +++ b/types/expo/v31/index.d.ts @@ -16,6 +16,7 @@ // Bartosz Dotryw // Jason Killian // Satyajit Sahoo +// Mattias Sämskar // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -2455,6 +2456,14 @@ export namespace Speech { function resume(): void; } +/** + * SplashScreen + */ +export namespace SplashScreen { + function hide(): void; + function preventAutoHide(): void; +} + /** * SQLite */ diff --git a/types/filesize/filesize-tests.ts b/types/filesize/filesize-tests.ts index 6980ac892d..aadc0542fa 100644 --- a/types/filesize/filesize-tests.ts +++ b/types/filesize/filesize-tests.ts @@ -15,6 +15,7 @@ filesize(265318, {standard: "iec"}); // "259.1 KiB" filesize(265318, {standard: "iec", fullform: true}); // "259.1 kibibytes" filesize(12, {fullform: true, fullforms: ["байтов"]}); // "12 байтов" filesize(265318, {separator: ","}); // "259,1 KB" +filesize(265318, {locale: 'de-DE'}); // "259,1 KB" const size = filesize.partial({standard: "iec"}); size(265318); diff --git a/types/filesize/index.d.ts b/types/filesize/index.d.ts index 33d04b66ff..958a5e3973 100644 --- a/types/filesize/index.d.ts +++ b/types/filesize/index.d.ts @@ -1,8 +1,9 @@ -// Type definitions for filesize 4.0 +// Type definitions for filesize 4.1 // Project: https://github.com/avoidwork/filesize.js, https://filesizejs.com // Definitions by: Giedrius Grabauskas // Renaud Chaput // Roman Nuritdinov +// Sam Hulick // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare var fileSize: Filesize.Filesize; @@ -57,6 +58,10 @@ declare namespace Filesize { * Array of full form overrides, default is [] */ fullforms?: string[]; + /** + * BCP 47 language tag to specify a locale, or true to use default locale, default is "" + */ + locale?: string | boolean; /** * Output of function (array, exponent, object, or string), default is string */ diff --git a/types/forge-viewer/index.d.ts b/types/forge-viewer/index.d.ts index bff0c637a0..8bb90b6d59 100644 --- a/types/forge-viewer/index.d.ts +++ b/types/forge-viewer/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Forge Viewer 6.3 +// Type definitions for Forge Viewer 6.4 // Project: https://forge.autodesk.com/en/docs/viewer/v6/reference/javascript/viewer3d/ // Definitions by: Autodesk Forge Partner Development , Alan Smith // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -150,6 +150,13 @@ declare namespace Autodesk { interface ViewerConfig { disableBrowserContextMenu?: boolean; + disabledExtensions?: { + bimwalk?: boolean; + hyperlink?: boolean; + measure?: boolean; + scalarisSimulation?: boolean; + section?: boolean; + }; extensions?: string[]; useConsolidation?: boolean; consolidationMemoryLimit?: number; @@ -238,10 +245,14 @@ declare namespace Autodesk { [key: string]: any; } + const AGGREGATE_FIT_TO_VIEW_EVENT = 'aggregateFitToView'; + const AGGREGATE_ISOLATION_CHANGED_EVENT = 'aggregateIsolation'; const AGGREGATE_SELECTION_CHANGED_EVENT = 'aggregateSelection'; const ANIMATION_READY_EVENT = 'animationReady'; const CAMERA_CHANGE_EVENT = 'cameraChanged'; + const CAMERA_TRANSITION_COMPLETED = 'cameraTransitionCompleted'; const CUTPLANES_CHANGE_EVENT = 'cutplanesChanged'; + const CANCEL_LEAFLET_SCREENSHOT = 'cancelLeafletScreenshot'; const ESCAPE_EVENT = 'escape'; const EXPLODE_CHANGE_EVENT = 'explodeChanged'; const EXTENSION_LOADED_EVENT = 'extensionLoaded'; @@ -251,12 +262,17 @@ declare namespace Autodesk { const FRAGMENTS_LOADED_EVENT = 'fragmentsLoaded'; const FULLSCREEN_MODE_EVENT = 'fullscreenMode'; const GEOMETRY_LOADED_EVENT = 'geometryLoaded'; + const GEOMETRY_DOWNLOAD_COMPLETE_EVENT = 'geometryDownloadComplete'; const HIDE_EVENT = 'hide'; const HYPERLINK_EVENT = 'hyperlink'; const ISOLATE_EVENT = 'isolate'; const LAYER_VISIBILITY_CHANGED_EVENT = 'layerVisibilityChanged'; + const LOAD_GEOMETRY_EVENT = 'loadGeometry'; const LOAD_MISSING_GEOMETRY = 'loadMissingGeometry'; + const MODEL_ADDED_EVENT = 'modelAdded'; const MODEL_ROOT_LOADED_EVENT = 'modelRootLoaded'; + const MODEL_REMOVED_EVENT = 'modelRemoved'; + const MODEL_LAYERS_LOADED_EVENT = 'modelLayersLoaded'; const MODEL_UNLOADED_EVENT = 'modelUnloaded'; const NAVIGATION_MODE_CHANGED_EVENT = 'navigationModeChanged'; const OBJECT_TREE_CREATED_EVENT = 'objectTreeCreated'; @@ -277,6 +293,7 @@ declare namespace Autodesk { const VIEWER_RESIZE_EVENT = 'viewerResize'; const VIEWER_STATE_RESTORED_EVENT = 'viewerStateRestored'; const VIEWER_UNINITIALIZED = 'viewerUninitialized'; + const WEBGL_CONTEXT_LOST_EVENT = 'webGlContextLost'; interface ViewerEventArgs { target?: Viewer3D; @@ -333,6 +350,7 @@ declare namespace Autodesk { setTag(tag: string, value: any): void; traverse(cb: () => void): boolean; urn(searchParent: boolean): string; + useAsDefault(): boolean; } let theExtensionManager: ExtensionManager; @@ -345,6 +363,7 @@ declare namespace Autodesk { language?: string; accessToken?: string; useADP?: boolean; + useConsolidation?: boolean; [key: string]: any; } @@ -438,16 +457,42 @@ declare namespace Autodesk { } class Model { - getBoundingBox(): THREE.Box3; + fetchTopology(maxSizeMB: number): Promise; getBulkProperties(dbIds: number[], propFilter?: string[], successCallback?: (r: any) => void, errorCallback?: (err: any) => void): void; getData(): any; getFragmentList(): any; getObjectTree(successCallback?: (result: InstanceTree) => void, errorCallback?: (err: any) => void): void; getProperties(dbId: number, successCallback?: (r: PropertyResult) => void, errorCallback?: (err: any) => void): void; + geomPolyCount(): number; + getDefaultCamera(): THREE.Camera; + getDisplayUnit(): string; + getDocumentNode(): object; + getExternalIdMapping(onSuccessCallback: () => void, onErrorCallback: () => void): any; + getFastLoadList(): any; + getFragmentMap(): any; // DbidFragmentMap|InstanceTree; + getLayersRoot(): object; + getMetadata(itemName: string, subitemName?: string, defaultValue?: any): any; + getRoot(): object; + getRootId(): number; + getTopoIndex(fragId: number): number; + getTopology(index: number): object; + getUnitData(unit: string): object; getUnitScale(): number; - getUnitString(): number; - - search(text: string, successCallback: (r: number[]) => void, errorCallback?: (err: any) => void, attributeNames?: string[]): void; + getUnitString(): string; + getUpVector(): any; + hasTopology(): boolean; + instancePolyCount(): number; + is2d(): boolean; + is3d(): boolean; + isAEC(): boolean; + isLoadDone(): boolean; + isObjectTreeCreated(): boolean; + isObjectTreeLoaded(): boolean; + pageToModel(): void; + pointInClip(): void; + search(text: string, onSuccessCallback: () => void, onErrorCallback: () => void, attributeNames?: string[]): void; + setData(data: object): void; + setUUID(urn: string): void; clearThemingColors(): void; getInstanceTree(): InstanceTree; @@ -760,6 +805,13 @@ declare namespace Autodesk { getHitPoint(x: number, y: number): THREE.Vector3; } + namespace Extensions { + class ViewerPropertyPanel extends UI.PropertyPanel { + constructor(viewer: Private.GuiViewer3D); + currentNodeIds: object[]; + } + } + namespace Private { function getHtmlTemplate(url: string, callback: (error: string, content: string) => void): void; @@ -850,11 +902,16 @@ declare namespace Autodesk { hitTestViewport(vpVec: THREE.Vector3, ignoreTransparent: boolean): HitTestResult; initialize(): void; setLightPreset(index: number, force?: boolean): void; - viewportToClient(viewportX: number, viewportY: number): THREE.Vector3; + viewportToClient(viewportX: number, viewportY: number): THREE.Vector3; + modelqueue(): any; + matman(): any; getMaterials(): any; + getScreenShotProgressive(w: number, h: number, onFinished?: () => void, options?: any): any; + getRenderProxy(model: Model, fragId: number): any; sceneUpdated(param: boolean): void; + setViewFromCamera(camera: THREE.Camera, skipTransition?: boolean, useExactCamera?: boolean): void; } class VisibilityManager { diff --git a/types/gl-vec2/add.d.ts b/types/gl-vec2/add.d.ts new file mode 100644 index 0000000000..f19025387f --- /dev/null +++ b/types/gl-vec2/add.d.ts @@ -0,0 +1,6 @@ +/** + * Adds two vec2's + */ +declare function add(out: number[], a: number[], b: number[]): number[]; + +export = add; diff --git a/types/gl-vec2/clone.d.ts b/types/gl-vec2/clone.d.ts new file mode 100644 index 0000000000..53f4fd9aea --- /dev/null +++ b/types/gl-vec2/clone.d.ts @@ -0,0 +1,6 @@ +/** + * Creates a new vec2 initialized with values from an existing vector + */ +declare function clone(a: number[]): number[]; + +export = clone; diff --git a/types/gl-vec2/copy.d.ts b/types/gl-vec2/copy.d.ts new file mode 100644 index 0000000000..8236100308 --- /dev/null +++ b/types/gl-vec2/copy.d.ts @@ -0,0 +1,6 @@ +/** + * Copy the values from one vec2 to another. + */ +declare function copy(out: number[], a: number[]): number[]; + +export = copy; diff --git a/types/gl-vec2/create.d.ts b/types/gl-vec2/create.d.ts new file mode 100644 index 0000000000..26b76eee80 --- /dev/null +++ b/types/gl-vec2/create.d.ts @@ -0,0 +1,6 @@ +/** + * Creates a new, empty vec2. + */ +declare function create(): number[]; + +export = create; diff --git a/types/gl-vec2/cross.d.ts b/types/gl-vec2/cross.d.ts new file mode 100644 index 0000000000..6ce6cab5f4 --- /dev/null +++ b/types/gl-vec2/cross.d.ts @@ -0,0 +1,6 @@ +/** + * Computes the cross product of two vec2's Note that the cross product must by definition produce a 3D vector. + */ +declare function cross(out: number[], a: number[], b: number[]): number[]; + +export = cross; diff --git a/types/gl-vec2/dist.d.ts b/types/gl-vec2/dist.d.ts new file mode 100644 index 0000000000..d83a49e3fb --- /dev/null +++ b/types/gl-vec2/dist.d.ts @@ -0,0 +1,6 @@ +/** + * Calculates the euclidian distance between two vec2's. Aliased as dist. + */ +declare function dist(a: number[], b: number[]): number; + +export = dist; diff --git a/types/gl-vec2/div.d.ts b/types/gl-vec2/div.d.ts new file mode 100644 index 0000000000..7999d6f3e9 --- /dev/null +++ b/types/gl-vec2/div.d.ts @@ -0,0 +1,6 @@ +/** + * Divides two vec2's. Aliased as div. + */ +declare function div(out: number[], a: number[], b: number[]): number[]; + +export = div; diff --git a/types/gl-vec2/dot.d.ts b/types/gl-vec2/dot.d.ts new file mode 100644 index 0000000000..60a7c484dc --- /dev/null +++ b/types/gl-vec2/dot.d.ts @@ -0,0 +1,6 @@ +/** + * Calculates the dot product of two vec2's. + */ +declare function dot(a: number[], b: number[]): number; + +export = dot; diff --git a/types/gl-vec2/equals.d.ts b/types/gl-vec2/equals.d.ts new file mode 100644 index 0000000000..3892372e7e --- /dev/null +++ b/types/gl-vec2/equals.d.ts @@ -0,0 +1,6 @@ +/** + * Returns whether or not the vectors have approximately the same elements in the same position. + */ +declare function equals(a: number[], b: number[]): boolean; + +export = equals; diff --git a/types/gl-vec2/exactEquals.d.ts b/types/gl-vec2/exactEquals.d.ts new file mode 100644 index 0000000000..ce8772b5fc --- /dev/null +++ b/types/gl-vec2/exactEquals.d.ts @@ -0,0 +1,6 @@ +/** + * Returns whether or not the vectors exactly have the same elements in the same position (when compared with ===). + */ +declare function exactEquals(a: number[], b: number[]): boolean; + +export = exactEquals; diff --git a/types/gl-vec2/floor.d.ts b/types/gl-vec2/floor.d.ts new file mode 100644 index 0000000000..7909d20a23 --- /dev/null +++ b/types/gl-vec2/floor.d.ts @@ -0,0 +1,6 @@ +/** + * Math.floor the components of a vec2. + */ +declare function floor(out: number[], a: number[]): number[]; + +export = floor; diff --git a/types/gl-vec2/forEach.d.ts b/types/gl-vec2/forEach.d.ts new file mode 100644 index 0000000000..7da060f549 --- /dev/null +++ b/types/gl-vec2/forEach.d.ts @@ -0,0 +1,6 @@ +/** + * Perform some operation over an array of vec2s. + */ +declare function forEach(a: number[], stride: number, offset: number, count: number, fn: (a: number[], b: number[], arg: object) => number[], arg: object): number[]; + +export = forEach; diff --git a/types/gl-vec2/fromValues.d.ts b/types/gl-vec2/fromValues.d.ts new file mode 100644 index 0000000000..7a3f7928e9 --- /dev/null +++ b/types/gl-vec2/fromValues.d.ts @@ -0,0 +1,6 @@ +/** + * Creates a new vec2 initialized with the given values. + */ +declare function fromValues(x: number, y: number): number[]; + +export = fromValues; diff --git a/types/gl-vec2/gl-vec2-tests.ts b/types/gl-vec2/gl-vec2-tests.ts new file mode 100644 index 0000000000..6db61462ac --- /dev/null +++ b/types/gl-vec2/gl-vec2-tests.ts @@ -0,0 +1,134 @@ +import GlVec2 = require("gl-vec2"); + +import GlVec2Add = require("gl-vec2/add"); +import GlVec2Clone = require("gl-vec2/clone"); +import GlVec2Copy = require("gl-vec2/copy"); +import GlVec2Create = require("gl-vec2/create"); +import GlVec2Cross = require("gl-vec2/cross"); +import GlVec2Dist = require("gl-vec2/dist"); +import GlVec2Div = require("gl-vec2/div"); +import GlVec2Dot = require("gl-vec2/dot"); +import GlVec2Equals = require("gl-vec2/equals"); +import GlVec2exactEquals = require("gl-vec2/exactEquals"); +import GlVec2forEach = require("gl-vec2/forEach"); +import GlVec2fromValues = require("gl-vec2/fromValues"); +import GlVec2Floor = require("gl-vec2/floor"); +import GlVec2Inverse = require("gl-vec2/inverse"); +import GlVec2Len = require("gl-vec2/len"); +import GlVec2Lerp = require("gl-vec2/lerp"); +import GlVec2Limit = require("gl-vec2/limit"); +import GlVec2Max = require("gl-vec2/max"); +import GlVec2Min = require("gl-vec2/min"); +import GlVec2Mul = require("gl-vec2/mul"); +import GlVec2Negate = require("gl-vec2/negate"); +import GlVec2Normalize = require("gl-vec2/normalize"); +import GlVec2Random = require("gl-vec2/random"); +import GlVec2Scale = require("gl-vec2/scale"); +import GlVec2ScaleAndAdd = require("gl-vec2/scaleAndAdd"); +import GlVec2Set = require("gl-vec2/set"); +import GlVec2SqrDist = require("gl-vec2/sqrDist"); +import GlVec2SqrLen = require("gl-vec2/sqrLen"); +import GlVec2Sub = require("gl-vec2/sub"); +import GlVec2TransformMat2 = require("gl-vec2/transformMat2"); +import GlVec2TransformMat2d = require("gl-vec2/transformMat2d"); +import GlVec2TransformMat3 = require("gl-vec2/transformMat3"); +import GlVec2TransformMat4 = require("gl-vec2/transformMat4"); + +GlVec2.add([1, 2, 3], [1, 2, 3], [1, 2, 3]); +GlVec2Add([1, 2, 3], [1, 2, 3], [1, 2, 3]); + +GlVec2.clone([1, 2, 3]); +GlVec2Clone([1, 2, 3]); + +GlVec2.copy([1, 2, 3], [1, 2, 3]); +GlVec2Copy([1, 2, 3], [1, 2, 3]); + +GlVec2.create(); +GlVec2Create(); + +GlVec2.cross([1, 2], [1, 2], [1, 2]); +GlVec2Cross([1, 2], [1, 2], [1, 2]); + +GlVec2.dist([1, 2, 3], [1, 2, 3]); +GlVec2Dist([1, 2, 3], [1, 2, 3]); + +GlVec2.div([1, 2, 3], [1, 2, 3], [1, 2, 3]); +GlVec2Div([1, 2, 3], [1, 2, 3], [1, 2, 3]); + +GlVec2.dot([1, 2, 3], [1, 2, 3]); +GlVec2Dot([1, 2, 3], [1, 2, 3]); + +GlVec2.forEach([1, 2, 3], 5, 6, 1, () => [3], {}); +GlVec2forEach([1, 2, 3], 5, 6, 1, () => [3], {}); + +GlVec2.fromValues(1, 2); +GlVec2fromValues(1, 2); + +GlVec2.floor([1, 2], [1, 2]); +GlVec2Floor([1, 2], [1, 2]); + +GlVec2.equals([1, 2, 3], [1, 2, 3]); +GlVec2Equals([1, 2, 3], [1, 2, 3]); + +GlVec2.exactEquals([1, 2, 3], [1, 2, 3]); +GlVec2exactEquals([1, 2, 3], [1, 2, 3]); + +GlVec2.inverse([1, 2, 3], [1, 2, 3]); +GlVec2Inverse([1, 2, 3], [1, 2, 3]); + +GlVec2.len([1, 2, 3]); +GlVec2Len([1, 2, 3]); + +GlVec2.lerp([1, 2, 3], [1, 2, 3], [1, 2, 3], 6); +GlVec2Lerp([1, 2, 3], [1, 2, 3], [1, 2, 3], 6); + +GlVec2.limit([1, 2], [1, 2], 5); +GlVec2Limit([1, 2], [1, 2], 5); + +GlVec2.max([1, 2, 3], [1, 2, 3], [1, 2, 3]); +GlVec2Max([1, 2, 3], [1, 2, 3], [1, 2, 3]); + +GlVec2.min([1, 2, 3], [1, 2, 3], [1, 2, 3]); +GlVec2Min([1, 2, 3], [1, 2, 3], [1, 2, 3]); + +GlVec2.mul([1, 2, 3], [1, 2, 3], [1, 2, 3]); +GlVec2Mul([1, 2, 3], [1, 2, 3], [1, 2, 3]); + +GlVec2.negate([1, 2, 3], [1, 2, 3]); +GlVec2Negate([1, 2, 3], [1, 2, 3]); + +GlVec2.normalize([1, 2, 3], [1, 2, 3]); +GlVec2Normalize([1, 2, 3], [1, 2, 3]); + +GlVec2.random([1, 2, 3], 6); +GlVec2Random([1, 2, 3], 6); + +GlVec2.scale([1, 2, 3], [1, 2, 3], 6); +GlVec2Scale([1, 2, 3], [1, 2, 3], 6); + +GlVec2.scaleAndAdd([1, 2, 3], [1, 2, 3], [1, 2, 3], 6); +GlVec2ScaleAndAdd([1, 2, 3], [1, 2, 3], [1, 2, 3], 6); + +GlVec2.set([1, 2], 1, 2); +GlVec2Set([1, 2], 1, 2); + +GlVec2.sqrDist([1, 2, 3], [1, 2, 3]); +GlVec2SqrDist([1, 2, 3], [1, 2, 3]); + +GlVec2.sqrLen([1, 2, 3]); +GlVec2SqrLen([1, 2, 3]); + +GlVec2.sub([1, 2, 3], [1, 2, 3], [1, 2, 3]); +GlVec2Sub([1, 2, 3], [1, 2, 3], [1, 2, 3]); + +GlVec2.transformMat2([1, 2, 3], [1, 2, 3], [1, 2, 3]); +GlVec2TransformMat2([1, 2, 3], [1, 2, 3], [1, 2, 3]); + +GlVec2.transformMat2([1, 2, 3], [1, 2, 3], [1, 2, 3]); +GlVec2TransformMat2d([1, 2, 3], [1, 2, 3], [1, 2, 3]); + +GlVec2.transformMat3([1, 2, 3], [1, 2, 3], [1, 2, 3]); +GlVec2TransformMat3([1, 2, 3], [1, 2, 3], [1, 2, 3]); + +GlVec2.transformMat4([1, 2, 3], [1, 2, 3], [1, 2, 3]); +GlVec2TransformMat4([1, 2, 3], [1, 2, 3], [1, 2, 3]); diff --git a/types/gl-vec2/index.d.ts b/types/gl-vec2/index.d.ts new file mode 100644 index 0000000000..65eb6ae91a --- /dev/null +++ b/types/gl-vec2/index.d.ts @@ -0,0 +1,75 @@ +// Type definitions for gl-vec2 1.3 +// Project: https://github.com/stackgl/gl-vec2 +// Definitions by: Adam Zerella +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.3 + +import add = require('./add'); +import clone = require('./clone'); +import copy = require('./copy'); +import create = require('./create'); +import cross = require('./cross'); +import dist = require('./dist'); +import div = require('./div'); +import dot = require('./dot'); +import equals = require('./equals'); +import exactEquals = require('./exactEquals'); +import floor = require('./floor'); +import forEach = require('./forEach'); +import fromValues = require('./fromValues'); +import inverse = require('./inverse'); +import len = require('./len'); +import lerp = require('./lerp'); +import limit = require('./limit'); +import max = require('./max'); +import min = require('./min'); +import mul = require('./mul'); +import negate = require('./negate'); +import normalize = require('./normalize'); +import random = require('./random'); +import scale = require('./scale'); +import scaleAndAdd = require('./scaleAndAdd'); +import set = require('./set'); +import sqrDist = require('./sqrDist'); +import sqrLen = require('./sqrLen'); +import sub = require('./sub'); +import transformMat2 = require('./transformMat2'); +import transformMat2d = require('./transformMat2d'); +import transformMat3 = require('./transformMat3'); +import transformMat4 = require('./transformMat4'); + +export { + add, + clone, + copy, + create, + cross, + dist, + div, + dot, + equals, + exactEquals, + floor, + forEach, + fromValues, + inverse, + len, + lerp, + limit, + max, + min, + mul, + negate, + normalize, + random, + scale, + scaleAndAdd, + set, + sqrDist, + sqrLen, + sub, + transformMat2, + transformMat2d, + transformMat3, + transformMat4 +}; diff --git a/types/gl-vec2/inverse.d.ts b/types/gl-vec2/inverse.d.ts new file mode 100644 index 0000000000..af3840b2a0 --- /dev/null +++ b/types/gl-vec2/inverse.d.ts @@ -0,0 +1,6 @@ +/** + * Returns the inverse of the components of a vec2. + */ +declare function inverse(out: number[], a: number[]): number[]; + +export = inverse; diff --git a/types/gl-vec2/len.d.ts b/types/gl-vec2/len.d.ts new file mode 100644 index 0000000000..cfb66abfae --- /dev/null +++ b/types/gl-vec2/len.d.ts @@ -0,0 +1,6 @@ +/** + * Calculates the length of a vec2. Aliased as len. + */ +declare function len(a: number[]): number; + +export = len; diff --git a/types/gl-vec2/lerp.d.ts b/types/gl-vec2/lerp.d.ts new file mode 100644 index 0000000000..d0c4ed4cda --- /dev/null +++ b/types/gl-vec2/lerp.d.ts @@ -0,0 +1,6 @@ +/** + * Performs a linear interpolation between two vec2's + */ +declare function lerp(out: number[], a: number[], b: number[], t: number): number[]; + +export = lerp; diff --git a/types/gl-vec2/limit.d.ts b/types/gl-vec2/limit.d.ts new file mode 100644 index 0000000000..abf7af287a --- /dev/null +++ b/types/gl-vec2/limit.d.ts @@ -0,0 +1,6 @@ +/** + * Limit the magnitude of this vector to the value used for the max parameter. + */ +declare function limit(out: number[], a: number[], max: number): number[]; + +export = limit; diff --git a/types/gl-vec2/max.d.ts b/types/gl-vec2/max.d.ts new file mode 100644 index 0000000000..38a64a2c34 --- /dev/null +++ b/types/gl-vec2/max.d.ts @@ -0,0 +1,6 @@ +/** + * Returns the maximum of two vec2's. + */ +declare function max(out: number[], a: number[], b: number[]): number[]; + +export = max; diff --git a/types/gl-vec2/min.d.ts b/types/gl-vec2/min.d.ts new file mode 100644 index 0000000000..19727a0e4e --- /dev/null +++ b/types/gl-vec2/min.d.ts @@ -0,0 +1,6 @@ +/** + * Returns the minimum of two vec2's. + */ +declare function min(out: number[], a: number[], b: number[]): number[]; + +export = min; diff --git a/types/gl-vec2/mul.d.ts b/types/gl-vec2/mul.d.ts new file mode 100644 index 0000000000..0322ca0e9d --- /dev/null +++ b/types/gl-vec2/mul.d.ts @@ -0,0 +1,6 @@ +/** + * Multiplies two vec2's. Aliased as mul. + */ +declare function mul(out: number[], a: number[], b: number[]): number[]; + +export = mul; diff --git a/types/gl-vec2/negate.d.ts b/types/gl-vec2/negate.d.ts new file mode 100644 index 0000000000..6edb8f50f6 --- /dev/null +++ b/types/gl-vec2/negate.d.ts @@ -0,0 +1,6 @@ +/** + * Negates the components of a vec2. + */ +declare function negate(out: number[], a: number[]): number[]; + +export = negate; diff --git a/types/gl-vec2/normalize.d.ts b/types/gl-vec2/normalize.d.ts new file mode 100644 index 0000000000..139a1c708e --- /dev/null +++ b/types/gl-vec2/normalize.d.ts @@ -0,0 +1,6 @@ +/** + * Normalize a number + */ +declare function normalize(out: number[], a: number[]): number[]; + +export = normalize; diff --git a/types/gl-vec2/random.d.ts b/types/gl-vec2/random.d.ts new file mode 100644 index 0000000000..0fa076543a --- /dev/null +++ b/types/gl-vec2/random.d.ts @@ -0,0 +1,6 @@ +/** + * Generates a random vector with the given scale. + */ +declare function random(out: number[], scale: number): number[]; + +export = random; diff --git a/types/gl-vec2/scale.d.ts b/types/gl-vec2/scale.d.ts new file mode 100644 index 0000000000..1348ff78c0 --- /dev/null +++ b/types/gl-vec2/scale.d.ts @@ -0,0 +1,6 @@ +/** + * Scales a vec2 by a scalar number. + */ +declare function scale(out: number[], a: number[], b: number): number[]; + +export = scale; diff --git a/types/gl-vec2/scaleAndAdd.d.ts b/types/gl-vec2/scaleAndAdd.d.ts new file mode 100644 index 0000000000..2a3e9b8a2d --- /dev/null +++ b/types/gl-vec2/scaleAndAdd.d.ts @@ -0,0 +1,6 @@ +/** + * Adds two vec2's after scaling the second operand by a scalar value. + */ +declare function scaleAndAdd(out: number[], a: number[], b: number[], scale: number): number[]; + +export = scaleAndAdd; diff --git a/types/gl-vec2/set.d.ts b/types/gl-vec2/set.d.ts new file mode 100644 index 0000000000..33ed71f0f3 --- /dev/null +++ b/types/gl-vec2/set.d.ts @@ -0,0 +1,6 @@ +/** + * Set the components of a vec2 to the given values. + */ +declare function set(out: number[], x: number, y: number): number[]; + +export = set; diff --git a/types/gl-vec2/sqrDist.d.ts b/types/gl-vec2/sqrDist.d.ts new file mode 100644 index 0000000000..d510d253e0 --- /dev/null +++ b/types/gl-vec2/sqrDist.d.ts @@ -0,0 +1,6 @@ +/** + * Calculates the squared euclidian distance between two vec2's. Aliased as sqrDist. + */ +declare function sqrDist(a: number[], b: number[]): number[]; + +export = sqrDist; diff --git a/types/gl-vec2/sqrLen.d.ts b/types/gl-vec2/sqrLen.d.ts new file mode 100644 index 0000000000..3237540072 --- /dev/null +++ b/types/gl-vec2/sqrLen.d.ts @@ -0,0 +1,6 @@ +/** + * Calculates the squared length of a vec2. Aliased as sqrLen. + */ +declare function sqrLen(a: number[]): number[]; + +export = sqrLen; diff --git a/types/gl-vec2/sub.d.ts b/types/gl-vec2/sub.d.ts new file mode 100644 index 0000000000..7b5976404d --- /dev/null +++ b/types/gl-vec2/sub.d.ts @@ -0,0 +1,6 @@ +/** + * Subtracts vector b from vector a. Aliased as sub. + */ +declare function sub(out: number[], a: number[], b: number[]): number[]; + +export = sub; diff --git a/types/gl-vec2/transformMat2.d.ts b/types/gl-vec2/transformMat2.d.ts new file mode 100644 index 0000000000..9ee67f7629 --- /dev/null +++ b/types/gl-vec2/transformMat2.d.ts @@ -0,0 +1,6 @@ +/** + * Transforms the vec2 with a mat2. + */ +declare function transformMat2(out: number[], a: number[], m: number[]): number[]; + +export = transformMat2; diff --git a/types/gl-vec2/transformMat2d.d.ts b/types/gl-vec2/transformMat2d.d.ts new file mode 100644 index 0000000000..978078f1da --- /dev/null +++ b/types/gl-vec2/transformMat2d.d.ts @@ -0,0 +1,6 @@ +/** + * Transforms the vec with a mat2d. + */ +declare function transformMat2d(out: number[], a: number[], m: number[]): number[]; + +export = transformMat2d; diff --git a/types/gl-vec2/transformMat3.d.ts b/types/gl-vec2/transformMat3.d.ts new file mode 100644 index 0000000000..682ded3966 --- /dev/null +++ b/types/gl-vec2/transformMat3.d.ts @@ -0,0 +1,6 @@ +/** + * Transforms the vec2 with a mat3 3rd vector component is implicitly '1' + */ +declare function transformMat3(out: number[], a: number[], m: number[]): number[]; + +export = transformMat3; diff --git a/types/gl-vec2/transformMat4.d.ts b/types/gl-vec2/transformMat4.d.ts new file mode 100644 index 0000000000..f7f96e6d41 --- /dev/null +++ b/types/gl-vec2/transformMat4.d.ts @@ -0,0 +1,6 @@ +/** + * Transforms the vec2 with a mat4 3rd vector component is implicitly '0' 4th vector component is implicitly '1' + */ +declare function transformMat4(out: number[], a: number[], m: number[]): number[]; + +export = transformMat4; diff --git a/types/gl-vec2/tsconfig.json b/types/gl-vec2/tsconfig.json new file mode 100644 index 0000000000..c1f24a1dad --- /dev/null +++ b/types/gl-vec2/tsconfig.json @@ -0,0 +1,58 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [ + + ], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "add.d.ts", + "clone.d.ts", + "copy.d.ts", + "create.d.ts", + "cross.d.ts", + "dist.d.ts", + "div.d.ts", + "dot.d.ts", + "equals.d.ts", + "exactEquals.d.ts", + "forEach.d.ts", + "fromValues.d.ts", + "floor.d.ts", + "inverse.d.ts", + "len.d.ts", + "lerp.d.ts", + "limit.d.ts", + "max.d.ts", + "min.d.ts", + "mul.d.ts", + "negate.d.ts", + "normalize.d.ts", + "random.d.ts", + "scale.d.ts", + "scaleAndAdd.d.ts", + "set.d.ts", + "sqrDist.d.ts", + "sqrLen.d.ts", + "sub.d.ts", + "transformMat2.d.ts", + "transformMat2d.d.ts", + "transformMat3.d.ts", + "transformMat4.d.ts", + "gl-vec2-tests.ts" + ] +} diff --git a/types/gl-vec2/tslint.json b/types/gl-vec2/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/gl-vec2/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/globby/globby-tests.ts b/types/globby/globby-tests.ts deleted file mode 100644 index e1a57adb74..0000000000 --- a/types/globby/globby-tests.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { IOptions } from 'glob'; - -import globby = require('globby'); - -(async () => { - let result: string[]; - - /** - * Standard `pattern` usage - */ - result = await globby('*.tmp'); - result = await globby(['a.tmp', '*.tmp', '!{c,d,e}.tmp']); - - result = globby.sync('*.tmp'); - result = globby.sync(['a.tmp', '*.tmp', '!{c,d,e}.tmp']); - - /** - * `expandDirectories` option - */ - result = await globby('*.tmp', { expandDirectories: false }); - result = globby.sync('*.tmp', { expandDirectories: false }); - result = await globby('*.tmp', { expandDirectories: ['a*', 'b*'] }); - result = globby.sync('*.tmp', { expandDirectories: ['a*', 'b*'] }); - result = await globby('*.tmp', { - expandDirectories: { - files: ['a', 'b'], - extensions: ['tmp'] - } - }); - result = globby.sync('*.tmp', { - expandDirectories: { - files: ['a', 'b'], - extensions: ['tmp'] - } - }); - - /** - * Options passed through from `fast-glob` - */ - result = await globby('*.tmp', { ignore: ['**/b.tmp'] }); - result = globby.sync('*.tmp', { ignore: ['**/b.tmp'] }); -})(); - -const tasks: Array<{ - pattern: string; - options: IOptions; -}> = globby.generateGlobTasks(['*.tmp', '!b.tmp'], { ignore: ['c.tmp'] }); - -console.log(globby.hasMagic('**')); -console.log(globby.hasMagic(['**', 'path1', 'path2'])); -console.log(!globby.hasMagic(['path1', 'path2'])); - -(async () => { - let result: (path: string) => boolean; - - /** - * Standard `gitignore` usage - */ - result = await globby.gitignore(); - result = globby.gitignore.sync(); - - /** With options */ - result = await globby.gitignore({ - cwd: __dirname, - ignore: ['**/b.tmp'] - }); - result = globby.gitignore.sync({ - cwd: __dirname, - ignore: ['**/b.tmp'] - }); -})(); diff --git a/types/globby/index.d.ts b/types/globby/index.d.ts deleted file mode 100644 index af49813432..0000000000 --- a/types/globby/index.d.ts +++ /dev/null @@ -1,99 +0,0 @@ -// Type definitions for globby 8.0 -// Project: https://github.com/sindresorhus/globby#readme -// Definitions by: Douglas Duteil -// Ika -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -import { IOptions as NodeGlobOptions } from 'glob'; -import { Options as FastGlobOptions } from 'fast-glob'; - -type ExpandDirectoriesOption = boolean | string[] | { files: string[]; extensions: string[] }; - -interface Options extends FastGlobOptions { - /** - * If set to `true`, `globby` will automatically glob directories for you. - * If you define an `Array` it will only glob files that matches the patterns inside the Array. - * You can also define an `Object` with `files` and `extensions` like below: - * - * ```js - * (async () => { - * const paths = await globby('images', { - * expandDirectories: { - * files: ['cat', 'unicorn', '*.jpg'], - * extensions: ['png'] - * } - * }); - * console.log(paths); - * //=> ['cat.png', 'unicorn.png', 'cow.jpg', 'rainbow.jpg'] - * })(); - * ``` - * - * Note that if you set this option to `false`, you won't get back matched directories unless - * you set `onlyFiles: false`. - */ - expandDirectories?: ExpandDirectoriesOption; - /** - * Respect ignore patterns in `.gitignore` files that apply to the globbed files. - */ - gitignore?: boolean; -} - -/** - * Returns a `Promise` of matching paths. - */ -declare function globby(patterns: string | string[], options?: Options): Promise; - -declare namespace globby { - /** - * Returns an `Array` of matching paths. - */ - function sync(patterns: string | string[], options?: Options): string[]; - /** - * Returns an `Array` in the format `{ pattern: string, opts: Object }`, - * which can be passed as arguments to [`fast-glob`](https://github.com/mrmlnc/fast-glob). - * This is useful for other globbing-related packages. - * - * Note that you should avoid running the same tasks multiple times as they contain a file system cache. - * Instead, run this method each time to ensure file system changes are taken into consideration. - */ - function generateGlobTasks(patterns: string | string[], options?: Options): Array<{ pattern: string; options: Options }>; - /** - * Returns a boolean of whether there are any special glob characters in the `patterns`. - * - * Note that the options affect the results. If `noext: true` is set, then `+(a|b)` will not - * be considered a magic pattern. If the pattern has a brace expansion, like `a/{b/c,x/y}`, - * then that is considered magical, unless `nobrace: true` is set. - * - * This function is backed by [`node-glob`](https://github.com/isaacs/node-glob#globhasmagicpattern-options) - */ - function hasMagic(patterns: string | string[], options?: NodeGlobOptions): boolean; - /** - * Returns a Promise<(path: string) => boolean> indicating whether a given path is ignored - * via a `.gitignore` file. - * - * Takes `cwd?: string` and `ignore?: string[]` as options. `.gitignore` files matched by the - * ignore config are not used for the resulting filter function. - * - * ```js - * const {gitignore} = require('globby'); - * - * (async () => { - * const isIgnored = await gitignore(); - * console.log(isIgnored('some/file')); - * })(); - * ``` - */ - function gitignore(options?: { cwd?: string; ignore?: string[]; }): Promise<(path: string) => boolean>; - - namespace gitignore { - /** - * Returns a `(path: string) => boolean` indicating whether a given path is ignored via a `.gitignore` file. - * - * Takes the same options as `globby.gitignore`. - */ - function sync(options?: { cwd?: string; ignore?: string[]; }): (path: string) => boolean; - } -} - -export = globby; diff --git a/types/globby/tsconfig.json b/types/globby/tsconfig.json deleted file mode 100644 index 5cc0a3fe62..0000000000 --- a/types/globby/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "globby-tests.ts" - ] -} \ No newline at end of file diff --git a/types/gyronorm/gyronorm-tests.ts b/types/gyronorm/gyronorm-tests.ts new file mode 100644 index 0000000000..d944b72bd0 --- /dev/null +++ b/types/gyronorm/gyronorm-tests.ts @@ -0,0 +1,21 @@ +import * as gyronorm from 'gyronorm'; + +const instance = new gyronorm.GyroNorm(); +const options: gyronorm.Options = { + frequency: 100 +}; + +instance.init(options) + .then(() => { + instance.startLogging((data) => { + const { message, code } = data; + }); + + instance.start((data) => { + const motion = data.dm; + const orientation = data.do; + }); + }) + .catch(() => { + // init failure + }); diff --git a/types/gyronorm/index.d.ts b/types/gyronorm/index.d.ts new file mode 100644 index 0000000000..2a1508da1f --- /dev/null +++ b/types/gyronorm/index.d.ts @@ -0,0 +1,88 @@ +// Type definitions for gyronorm 2.0 +// Project: https://github.com/dorukeker/gyronorm.js +// Definitions by: Evan Shortiss +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface MotionAndOrientationPayload { + do: { + alpha: number; + beta: number; + gamma: number; + absolute: number; + }; + + dm: { + x: number; + y: number; + z: number; + + gx: number; + gy: number; + gz: number; + + alpha: number; + beta: number; + gamma: number; + }; +} + +export interface Options { + /** + * How often GyroNorm returns data (in milliseconds) + */ + frequency?: number; + + /** + * If the gravity related values to be normalized + */ + gravityNormalized?: boolean; + + /** + * Can be GyroNorm.GAME or GyroNorm.WORLD. gn.GAME returns + * orientation values with respect to the head direction of the device. + * gn.WORLD returns the orientation values with respect to the actual + * north direction of the world. + */ + orientationBase?: string; + + /** + * How many digits after the decimal point will there be in the return values + */ + decimalCount?: number; + + /** + * Function to be called to log messages from gyronorm.js + */ + logger?: LogListener; + + /** + * If set to true it will return screen adjusted values + */ + screenAdjusted?: boolean; +} + +export interface LoggerData { + code: number; + message: string; +} + +export type LogListener = (data: LoggerData) => void; + +export class GyroNorm { + constructor() + + static GAME: string; + static WORLD: string; + + static DEVICE_ORIENTATION: string; + static ACCELERATION: string; + static ACCELERATION_INCLUDING_GRAVITY: string; + static ROTATION_RATE: string; + + init(options: Options): Promise; + + start(callback: (data: MotionAndOrientationPayload) => void): void; + + startLogging(listener: LogListener): void; + stopLogging(): void; +} diff --git a/types/pkg-conf/tsconfig.json b/types/gyronorm/tsconfig.json similarity index 94% rename from types/pkg-conf/tsconfig.json rename to types/gyronorm/tsconfig.json index 449922d19e..8b8dedb9c0 100644 --- a/types/pkg-conf/tsconfig.json +++ b/types/gyronorm/tsconfig.json @@ -7,17 +7,17 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, - "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" ], "types": [], "noEmit": true, + "strictFunctionTypes": true, "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", - "pkg-conf-tests.ts" + "gyronorm-tests.ts" ] } diff --git a/types/log-update/tslint.json b/types/gyronorm/tslint.json similarity index 100% rename from types/log-update/tslint.json rename to types/gyronorm/tslint.json diff --git a/types/hbs/package.json b/types/hbs/package.json new file mode 100644 index 0000000000..77c0c562ac --- /dev/null +++ b/types/hbs/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "handlebars": "^4.1.0" + } +} diff --git a/types/helmet/helmet-tests.ts b/types/helmet/helmet-tests.ts index 8b4c5634ac..39414a7d5f 100644 --- a/types/helmet/helmet-tests.ts +++ b/types/helmet/helmet-tests.ts @@ -119,6 +119,13 @@ function hpkpTest() { sha256s: ['AbCdEf123=', 'ZyXwVu456='], })); + app.use(helmet.hpkp({ + maxAge: 7776000000, + sha256s: ['AbCdEf123=', 'ZyXwVu456='], + includeSubDomains: false + })); + + // Deprecated: Use includeSubDomains instead. (Uppercase "D") app.use(helmet.hpkp({ maxAge: 7776000000, sha256s: ['AbCdEf123=', 'ZyXwVu456='], @@ -128,7 +135,7 @@ function hpkpTest() { app.use(helmet.hpkp({ maxAge: 7776000000, sha256s: ['AbCdEf123=', 'ZyXwVu456='], - includeSubdomains: true + includeSubDomains: true })); app.use(helmet.hpkp({ @@ -162,6 +169,12 @@ function hstsTest() { maxAge: 7776000000, })); + app.use(helmet.hsts({ + maxAge: 7776000000, + includeSubDomains: true + })); + + // Deprecated: Use includeSubDomains instead. (Uppercase "D") app.use(helmet.hsts({ maxAge: 7776000000, includeSubdomains: true diff --git a/types/helmet/index.d.ts b/types/helmet/index.d.ts index b0a50c901e..1a8c713da1 100644 --- a/types/helmet/index.d.ts +++ b/types/helmet/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for helmet // Project: https://github.com/helmetjs/helmet -// Definitions by: Cyril Schumacher , Evan Hahn , Elliot Blackburn +// Definitions by: Cyril Schumacher , Evan Hahn , Elliot Blackburn , Daniel Müller // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -134,7 +134,11 @@ declare namespace helmet { export interface IHelmetHpkpConfiguration { maxAge: number; sha256s: string[]; + /** + * @deprecated Use includeSubDomains instead. (Uppercase "D") + */ includeSubdomains?: boolean; + includeSubDomains?: boolean; reportUri?: string; reportOnly?: boolean; setIf?: IHelmetSetIfFunction; @@ -142,7 +146,11 @@ declare namespace helmet { export interface IHelmetHstsConfiguration { maxAge?: number; + /** + * @deprecated Use includeSubDomains instead. (Uppercase "D") + */ includeSubdomains?: boolean; + includeSubDomains?: boolean; preload?: boolean; setIf?: IHelmetSetIfFunction; force?: boolean; diff --git a/types/html-truncate/html-truncate-tests.ts b/types/html-truncate/html-truncate-tests.ts new file mode 100644 index 0000000000..30f6a19e7c --- /dev/null +++ b/types/html-truncate/html-truncate-tests.ts @@ -0,0 +1,13 @@ +import Truncate = require("html-truncate"); + +Truncate('hello world', 4); + +Truncate('

hello world

', 4, { + keepImageTag: true, + ellipsis: true +}); + +Truncate('

hello world

', 6, { + keepImageTag: false, + ellipsis: '---' +}); diff --git a/types/html-truncate/index.d.ts b/types/html-truncate/index.d.ts new file mode 100644 index 0000000000..4784caa925 --- /dev/null +++ b/types/html-truncate/index.d.ts @@ -0,0 +1,23 @@ +// Type definitions for html-truncate 1.2 +// Project: https://github.com/huang47/nodejs-html-truncate +// Definitions by: Adam Zerella +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 + +interface TruncateOptions { + /** + * Flag to specify if keep image tag, false by default. + */ + keepImageTag: boolean; + /** + * Omission symbol for truncated string, '...' by default. + */ + ellipsis: boolean|string; +} + +/** + * Truncate HTML text and also keep tag safe. + */ +declare function truncate(input: string, maxLength: number, options?: TruncateOptions): string; + +export = truncate; diff --git a/types/html-truncate/tsconfig.json b/types/html-truncate/tsconfig.json new file mode 100644 index 0000000000..693d5d17ba --- /dev/null +++ b/types/html-truncate/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", + "html-truncate-tests.ts" + ] +} diff --git a/types/html-truncate/tslint.json b/types/html-truncate/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/html-truncate/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/html5-history/html5-history-tests.ts b/types/html5-history/html5-history-tests.ts new file mode 100644 index 0000000000..b492e46366 --- /dev/null +++ b/types/html5-history/html5-history-tests.ts @@ -0,0 +1,10 @@ +import * as History from 'html5-history'; + +History.init(); +History.getState(); +History.getCurrentIndex(); +History.getStateByIndex(1); +History.getHash(0); +History.unescapeHash(0); +History.normalizeHash(0); +History.setHash(1, 2); diff --git a/types/html5-history/index.d.ts b/types/html5-history/index.d.ts new file mode 100644 index 0000000000..614928f79e --- /dev/null +++ b/types/html5-history/index.d.ts @@ -0,0 +1,14 @@ +// Type definitions for html5-history 0.1 +// Project: https://github.com/Raynos/html5-history +// Definitions by: Akash Vishwakarma +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +export function init(options?: any): boolean; +export function getState(friendly?: any, create?: any): any; +export function getCurrentIndex(): number; +export function getStateByIndex(index: number): any; +export function getHash(doc: any): any; +export function unescapeHash(hash: any): any; +export function normalizeHash(hash: any): any; +export function setHash(hash: any, queue: any): boolean; diff --git a/types/conf/tsconfig.json b/types/html5-history/tsconfig.json similarity index 86% rename from types/conf/tsconfig.json rename to types/html5-history/tsconfig.json index 479fa6b41f..b4bc53cbb5 100644 --- a/types/conf/tsconfig.json +++ b/types/html5-history/tsconfig.json @@ -2,9 +2,9 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], - "target": "es6", "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, @@ -19,6 +19,6 @@ }, "files": [ "index.d.ts", - "conf-tests.ts" + "html5-history-tests.ts" ] } diff --git a/types/html5-history/tslint.json b/types/html5-history/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/html5-history/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/http-proxy/index.d.ts b/types/http-proxy/index.d.ts index 2560b0a38d..80e09de68f 100644 --- a/types/http-proxy/index.d.ts +++ b/types/http-proxy/index.d.ts @@ -1,8 +1,9 @@ -// Type definitions for node-http-proxy 1.16 +// Type definitions for node-http-proxy 1.17 // Project: https://github.com/nodejitsu/node-http-proxy // Definitions by: Maxime LUCE // Florian Oellerich // Daniel Schmidt +// Jordan Abreu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -165,8 +166,6 @@ declare class Server extends events.EventEmitter { declare namespace Server { interface ServerOptions { - /** Buffer */ - buffer?: stream.Stream; /** URL string to be parsed with the url module. */ target?: ProxyTargetUrl; /** URL string to be parsed with the url module. */ @@ -203,12 +202,20 @@ declare namespace Server { protocolRewrite?: string; /** rewrites domain of set-cookie headers. */ cookieDomainRewrite?: false | string | {[oldDomain: string]: string}; + /** rewrites path of set-cookie headers. Default: false */ + cookiePathRewrite?: false | string | {[oldPath: string]: string}; /** object with extra headers to be added to target requests. */ headers?: {[header: string]: string}; /** Timeout (in milliseconds) when proxy receives no response from target. Default: 120000 (2 minutes) */ proxyTimeout?: number; + /** Timeout (in milliseconds) for incoming requests */ + timeout?: number; + /** Specify whether you want to follow redirects. Default: false */ + followRedirects?: boolean; /** If set to true, none of the webOutgoing passes are called and it's your responsibility to appropriately return the response by listening and acting on the proxyRes event */ selfHandleResponse?: boolean; + /** Buffer */ + buffer?: stream.Stream; } } diff --git a/types/ioredis/index.d.ts b/types/ioredis/index.d.ts index 99c99dcf04..869dc364c9 100644 --- a/types/ioredis/index.d.ts +++ b/types/ioredis/index.d.ts @@ -875,10 +875,20 @@ declare namespace IORedis { type NodeRole = 'master' | 'slave' | 'all'; + type CallbackFunction = (err?: NodeJS.ErrnoException | null, result?: T) => void; + interface Cluster extends NodeJS.EventEmitter, Commander { connect(callback: () => void): Promise; disconnect(): void; nodes(role?: NodeRole): Redis[]; + quit(callback?: CallbackFunction<'OK'>): Promise<'OK'>; + get(key: KeyType, callback: (err: Error, res: string | null) => void): void; + get(key: KeyType): Promise; + set(key: KeyType, value: any, expiryMode?: string | any[], time?: number | string, setMode?: number | string): Promise; + set(key: KeyType, value: any, callback: (err: Error, res: string) => void): void; + set(key: KeyType, value: any, setMode: string | any[], callback: (err: Error, res: string) => void): void; + set(key: KeyType, value: any, expiryMode: string, time: number | string, callback: (err: Error, res: string) => void): void; + set(key: KeyType, value: any, expiryMode: string, time: number | string, setMode: number | string, callback: (err: Error, res: string) => void): void; } interface ClusterStatic extends NodeJS.EventEmitter, Commander { diff --git a/types/ioredis/ioredis-tests.ts b/types/ioredis/ioredis-tests.ts index f3cafe1f18..57ee06a5f3 100644 --- a/types/ioredis/ioredis-tests.ts +++ b/types/ioredis/ioredis-tests.ts @@ -226,3 +226,32 @@ cluster.nodes().map(node => { .exec() .then(result => console.log(result)); }); +cluster.set('foo', 'bar'); +cluster.get('foo', (err, result) => { + if (err) { + console.error(err); + } + console.log(result); +}); +cluster.get('foo') + .then(result => console.log(result)) + .catch(reason => console.error(reason)); +cluster.connect(() => { + console.log('connect'); +}) +.then(result => console.log(result)) +.then(reason => console.error(reason)); +cluster.disconnect(); +cluster.quit(result => { + console.log(result); +}); +const getBuiltinCommandsResult = cluster.getBuiltinCommands(); +console.log(getBuiltinCommandsResult); +const createBuiltinCommandResult = cluster.createBuiltinCommand('createBuiltinCommand'); +console.log(createBuiltinCommandResult); +const defineCommandResult = cluster.defineCommand('defineCommand', { + numberOfKeys: 1, + lua: 'lua' +}); +console.log(defineCommandResult); +cluster.sendCommand(); diff --git a/types/is-integer/index.d.ts b/types/is-integer/index.d.ts new file mode 100644 index 0000000000..46708e5068 --- /dev/null +++ b/types/is-integer/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for is-integer 1.0 +// Project: https://github.com/parshap/js-is-integer#readme +// Definitions by: Daniel Cassidy +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function isInteger(val: any): boolean; + +export = isInteger; diff --git a/types/is-integer/is-integer-tests.ts b/types/is-integer/is-integer-tests.ts new file mode 100644 index 0000000000..f414281fc6 --- /dev/null +++ b/types/is-integer/is-integer-tests.ts @@ -0,0 +1,16 @@ +import isInteger = require("is-integer"); + +// $ExpectType boolean +isInteger("hello"); + +// $ExpectType boolean +isInteger(4); + +// $ExpectType boolean +isInteger(4.0); + +// $ExpectType boolean +isInteger(4.1); + +// $ExpectType boolean +isInteger({}); diff --git a/types/move-file/tsconfig.json b/types/is-integer/tsconfig.json similarity index 93% rename from types/move-file/tsconfig.json rename to types/is-integer/tsconfig.json index bcd3f7550e..7b4310e320 100644 --- a/types/move-file/tsconfig.json +++ b/types/is-integer/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", - "move-file-tests.ts" + "is-integer-tests.ts" ] } diff --git a/types/move-file/tslint.json b/types/is-integer/tslint.json similarity index 100% rename from types/move-file/tslint.json rename to types/is-integer/tslint.json diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index da84c876af..86a627c61d 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for Jest 24.0 -// Project: http://facebook.github.io/jest/ +// Project: https://jestjs.io // Definitions by: Asana // Ivo Stratev // jwbay @@ -154,6 +154,11 @@ declare namespace jest { * useful to isolate modules where local state might conflict between tests. */ function resetModules(): typeof jest; + /** + * Creates a sandbox registry for the modules that are loaded inside the callback function.. + * This is useful to isolate specific modules for every test so that local module state doesn't conflict between tests. + */ + function isolateModules(fn: () => void): typeof jest; /** * Runs failed tests n-times until they pass or until the max number of retries is exhausted. * This only works with jest-circus! @@ -264,7 +269,23 @@ declare namespace jest { } interface Each { - (cases: any[]): (name: string, fn: (...args: any[]) => any, timeout?: number) => void; + // Exclusively arrays. + (cases: ReadonlyArray): ( + name: string, + fn: (...args: T) => any, + timeout?: number + ) => void; + // Not arrays. + (cases: ReadonlyArray): ( + name: string, + fn: (...args: T[]) => any, + timeout?: number + ) => void; + (cases: ReadonlyArray>): ( + name: string, + fn: (...args: any[]) => any, + timeout?: number + ) => void; (strings: TemplateStringsArray, ...placeholders: any[]): ( name: string, fn: (arg: any) => any, diff --git a/types/jest/jest-tests.ts b/types/jest/jest-tests.ts index 039d996f5c..b3356f044d 100644 --- a/types/jest/jest-tests.ts +++ b/types/jest/jest-tests.ts @@ -267,6 +267,7 @@ jest .mock("moduleName", jest.fn(), { virtual: true }) .resetModuleRegistry() .resetModules() + .isolateModules(() => {}) .retryTimes(3) .runAllImmediates() .runAllTicks() diff --git a/types/jsonwebtoken/index.d.ts b/types/jsonwebtoken/index.d.ts index 33d4f7b999..9ab87a022a 100644 --- a/types/jsonwebtoken/index.d.ts +++ b/types/jsonwebtoken/index.d.ts @@ -4,7 +4,8 @@ // Daniel Heim , // Brice BERNARD , // Veli-Pekka Kestilä , -// Daniel Parker +// Daniel Parker , +// Kjell Dießel // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -17,9 +18,9 @@ export class JsonWebTokenError extends Error { } export class TokenExpiredError extends JsonWebTokenError { - expiredAt: number; + expiredAt: Date; - constructor(message: string, expiredAt: number); + constructor(message: string, expiredAt: Date); } export class NotBeforeError extends JsonWebTokenError { diff --git a/types/jsreport-html-to-xlsx/index.d.ts b/types/jsreport-html-to-xlsx/index.d.ts index 83ac765c1f..85850dcbe7 100644 --- a/types/jsreport-html-to-xlsx/index.d.ts +++ b/types/jsreport-html-to-xlsx/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for jsreport-html-to-xlsx 2.0 // Project: https://github.com/jsreport/jsreport-html-to-xlsx -// Definitions by: My Self +// Definitions by: Tao Quifeng // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/jsreport-html-to-xlsx/v1/index.d.ts b/types/jsreport-html-to-xlsx/v1/index.d.ts index 84b37480aa..8801d637a2 100644 --- a/types/jsreport-html-to-xlsx/v1/index.d.ts +++ b/types/jsreport-html-to-xlsx/v1/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for jsreport-html-to-xlsx 1.4 // Project: https://github.com/jsreport/jsreport-html-to-xlsx -// Definitions by: My Self +// Definitions by: Tao Quifeng // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/kafkajs/index.d.ts b/types/kafkajs/index.d.ts index a28377e369..c416a07063 100644 --- a/types/kafkajs/index.d.ts +++ b/types/kafkajs/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for kafkajs 1.4 -// Project: https://github.com/tulios/kafkajs +// Project: https://github.com/tulios/kafkajs, https://kafka.js.org // Definitions by: Michal Kaminski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.9 diff --git a/types/keytar/index.d.ts b/types/keytar/index.d.ts index cf6a16e4f7..f5e8e7367a 100644 --- a/types/keytar/index.d.ts +++ b/types/keytar/index.d.ts @@ -1,6 +1,9 @@ -// Type definitions for keytar 4.0.2 +// Type definitions for keytar 4.4.1 // Project: http://atom.github.io/node-keytar/ -// Definitions by: Milan Burda , Brendan Forster , Hari Juturu +// Definitions by: Milan Burda +// Brendan Forster +// Hari Juturu +// Queenie Ma // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -15,7 +18,7 @@ export declare function getPassword(service: string, account: string): Promise; /** - * Add the password for the service and account to the keychain. + * Save the password for the service and account to the keychain. Adds a new entry if necessary, or updates an existing entry if one exists. * * @param service The string service name. * @param account The string account name. @@ -36,7 +39,16 @@ export declare function setPassword(service: string, account: string, password: export declare function deletePassword(service: string, account: string): Promise; /** - * Find a password for the service in the keychain. + * Find all accounts and password for the service in the keychain. + * + * @param service The string service name. + * + * @returns A promise for the credentials array. + */ +export declare function findCredentials(service: string): Promise>; + +/** + * Find a password for the service in the keychain. This is ideal for scenarios where an account is not required. * * @param service The string service name. * diff --git a/types/keytar/keytar-tests.ts b/types/keytar/keytar-tests.ts index f6873838c2..18a7423450 100644 --- a/types/keytar/keytar-tests.ts +++ b/types/keytar/keytar-tests.ts @@ -8,6 +8,8 @@ let success: Promise; success = keytar.deletePassword('keytar-tests', 'username'); let password: Promise; - password = keytar.findPassword('keytar-tests'); password = keytar.getPassword('keytar-tests', 'username'); + +let credentials: Promise>; +credentials = keytar.findCredentials('keytar-tests'); diff --git a/types/koa-hbs/package.json b/types/koa-hbs/package.json new file mode 100644 index 0000000000..77c0c562ac --- /dev/null +++ b/types/koa-hbs/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "handlebars": "^4.1.0" + } +} diff --git a/types/koa-helmet/koa-helmet-tests.ts b/types/koa-helmet/koa-helmet-tests.ts index 2290ab07fa..34bca1958a 100644 --- a/types/koa-helmet/koa-helmet-tests.ts +++ b/types/koa-helmet/koa-helmet-tests.ts @@ -95,13 +95,13 @@ function hpkpTest() { app.use(helmet.hpkp({ maxAge: 7776000000, sha256s: ['AbCdEf123=', 'ZyXwVu456='], - includeSubdomains: false + includeSubDomains: false })); app.use(helmet.hpkp({ maxAge: 7776000000, sha256s: ['AbCdEf123=', 'ZyXwVu456='], - includeSubdomains: true + includeSubDomains: true })); app.use(helmet.hpkp({ @@ -137,7 +137,7 @@ function hstsTest() { app.use(helmet.hsts({ maxAge: 7776000000, - includeSubdomains: true + includeSubDomains: true })); app.use(helmet.hsts({ diff --git a/types/koa-log4/index.d.ts b/types/koa-log4/index.d.ts new file mode 100644 index 0000000000..e47cfc4e07 --- /dev/null +++ b/types/koa-log4/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for koa-log4 2.3 +// Project: https://github.com/dominhhai/koa-log4js#readme +// Definitions by: Cr. +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.3 + +import * as Koa from 'koa'; +import * as Log4js from 'log4js'; + +export function koaLogger(logger4js: Log4js.Logger, optionsOrFormat?: Options | string): Koa.Middleware; + +export interface Options { + format?: string; + level?: Log4js.Level; +} + +export * from 'log4js'; diff --git a/types/koa-log4/koa-log4-tests.ts b/types/koa-log4/koa-log4-tests.ts new file mode 100644 index 0000000000..cb8d377eb8 --- /dev/null +++ b/types/koa-log4/koa-log4-tests.ts @@ -0,0 +1,18 @@ +import Koa = require('koa'); +import KoaLog4 = require('koa-log4'); + +const DEFAULT_FORMAT = ':remote-addr - -' + + ' ":method :url HTTP/:http-version"' + + ' :status :content-length ":referrer"' + + ' ":user-agent"'; + +const DEFAULT_OPTIONS: KoaLog4.Options = { + format: DEFAULT_FORMAT, + level: KoaLog4.levels.INFO +}; + +const koaLog4Mid = KoaLog4.koaLogger(KoaLog4.getLogger(), DEFAULT_OPTIONS); + +const app = new Koa(); +app.use(koaLog4Mid); +app.listen(80); diff --git a/types/koa-log4/package.json b/types/koa-log4/package.json new file mode 100644 index 0000000000..5c070feace --- /dev/null +++ b/types/koa-log4/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "log4js": "^3.0.0" + } +} \ No newline at end of file diff --git a/types/koa-log4/tsconfig.json b/types/koa-log4/tsconfig.json new file mode 100644 index 0000000000..71abbe0755 --- /dev/null +++ b/types/koa-log4/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes":false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "koa-log4-tests.ts" + ] +} diff --git a/types/on-change/tslint.json b/types/koa-log4/tslint.json similarity index 100% rename from types/on-change/tslint.json rename to types/koa-log4/tslint.json diff --git a/types/kue/index.d.ts b/types/kue/index.d.ts index 9153039ff0..f6aa357e66 100644 --- a/types/kue/index.d.ts +++ b/types/kue/index.d.ts @@ -33,7 +33,8 @@ export declare class Queue extends events.EventEmitter { checkActiveJobTtl(ttlOptions: Object): void; watchStuckJobs(ms: number): void; setting(name: string, fn: Function): Queue; - process(type: string, n?: number | ProcessCallback, fn?: ProcessCallback): void; + process(type: string, fn?: ProcessCallback): void; + process(type: string, n: number, fn?: ProcessCallback): void; shutdown(timeout: number, fn: Function): Queue; shutdown(timeout: number, type: string, fn: Function): Queue; types(fn: Function): Queue; @@ -63,7 +64,9 @@ interface Priorities { export type DoneCallback = (err?: any, result?: any) => void; export type JobCallback = (err?: any, job?: Job) => void; -export type ProcessCallback = (job: Job, cb: DoneCallback) => void; +export type ProcessCallback = + | ((job: Job, cb: DoneCallback) => void) + | ((job: Job, ctx: WorkerCtx, cb: DoneCallback) => void); export declare class Job extends events.EventEmitter { public id: number; @@ -144,6 +147,13 @@ declare class Worker extends events.EventEmitter { resume(): boolean; } +interface WorkerCtx { + pause(fn?: DoneCallback): void; + pause(timeout: number, fn?: DoneCallback): void; + resume(): void; + shutdown(): void; +} + interface Redis { configureFactory(options: Object, queue: Queue): void; createClient(): redisClientFactory.RedisClient; diff --git a/types/kue/kue-tests.ts b/types/kue/kue-tests.ts index 9234101e05..552bca1ddf 100644 --- a/types/kue/kue-tests.ts +++ b/types/kue/kue-tests.ts @@ -79,6 +79,14 @@ var processCb = function(job: kue.Job, done: kue.DoneCallback) { jobs.process('video conversion', 1, processCb); jobs.process('video conversion', processCb); +// Use of WorkerCtx, https://github.com/Automattic/kue#pause-processing +jobs.process('email', function(job, ctx, done) { + ctx.pause(5000, function (err) { + console.log('Worker is paused...'); + setTimeout(function() { ctx.resume(); }, 10000); + }); +}); + function convertFrame(i: number, fn: Function) { setTimeout(() => fn(null, Math.random()), Math.random() * 50); } diff --git a/types/log-update/index.d.ts b/types/log-update/index.d.ts deleted file mode 100644 index 544223a766..0000000000 --- a/types/log-update/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -// Type definitions for log-update 2.0 -// Project: https://github.com/sindresorhus/log-update#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -export = logUpdate; - -declare function logUpdate(...text: string[]): void; - -declare namespace logUpdate { - function clear(): void; - function done(): void; - const stderr: typeof logUpdate; - function create(stream: NodeJS.WritableStream): typeof logUpdate; -} diff --git a/types/log-update/log-update-tests.ts b/types/log-update/log-update-tests.ts deleted file mode 100644 index 9a0955f7d4..0000000000 --- a/types/log-update/log-update-tests.ts +++ /dev/null @@ -1,19 +0,0 @@ -import logUpdate = require('log-update'); - -logUpdate(` - ♥♥ - unicorns - ♥♥ -`); - -logUpdate.clear(); -logUpdate.done(); - -logUpdate.stderr('oh', 'my', 'oh', 'my'); -logUpdate.stderr.clear(); -logUpdate.stderr.done(); - -const logStdOut = logUpdate.create(process.stdout); -logStdOut('oh', 'my', 'oh', 'my'); -logStdOut.clear(); -logStdOut.done(); diff --git a/types/lolex/index.d.ts b/types/lolex/index.d.ts index 35c4880a5b..1a33a60c7d 100644 --- a/types/lolex/index.d.ts +++ b/types/lolex/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for lolex 3 +// Type definitions for lolex 3.1 // Project: https://github.com/sinonjs/lolex // Definitions by: Wim Looman // Josh Goldberg @@ -9,7 +9,7 @@ /** * Names of clock methods that may be faked by install. */ -type FakeMethod = "setTimeout" | "clearTimeout" | "setImmediate" | "clearImmediate" | "setInterval" | "clearInterval" | "Date" | "nextTick" | "hrtime"; +type FakeMethod = "setTimeout" | "clearTimeout" | "setImmediate" | "clearImmediate" | "setInterval" | "clearInterval" | "Date" | "nextTick" | "hrtime" | "requestAnimationFrame" | "cancelAnimationFrame" | "requestIdleCallback" | "cancelIdleCallback"; /** * Global methods avaliable to every clock and also as standalone methods (inside `timers` global object). @@ -126,6 +126,22 @@ export interface LolexClock extends GlobalTimers void; + /** + * Queues the callback to be fired during idle periods to perform background and low priority work on the main event loop. + * + * @param callback Callback to be fired. + * @param timeout The maximum number of ticks before the callback must be fired. + * @remarks Callbacks which have a timeout option will be fired no later than time in milliseconds. + */ + requestIdleCallback: (callback: () => void, timeout?: number) => TTimerId; + + /** + * Clears a timer, as long as it was created using requestIdleCallback. + * + * @param id Timer ID or object. + */ + cancelIdleCallback: (id: TTimerId) => void; + /** * Get the number of waiting timers. * diff --git a/types/lolex/lolex-tests.ts b/types/lolex/lolex-tests.ts index 2a01dd5916..d09cfcc042 100644 --- a/types/lolex/lolex-tests.ts +++ b/types/lolex/lolex-tests.ts @@ -59,10 +59,14 @@ const browserTimeout: number = browserClock.setTimeout(() => {}, 7); const browserInterval: number = browserClock.setInterval(() => {}, 7); const browserImmediate: number = browserClock.setImmediate(() => {}); const browserAnimationFrame: number = browserClock.requestAnimationFrame(() => {}); +const browserIdleCallback: number = browserClock.requestIdleCallback(() => {}); +const browserIdleCallbackWithTimeout: number = browserClock.requestIdleCallback(() => {}, 7); const nodeTimeout: lolex.NodeTimer = nodeClock.setTimeout(() => {}, 7); const nodeInterval: lolex.NodeTimer = nodeClock.setInterval(() => {}, 7); const nodeImmediate: lolex.NodeTimer = nodeClock.setImmediate(() => {}); const nodeAnimationFrame: lolex.NodeTimer = nodeClock.requestAnimationFrame(() => {}); +const nodeIdleCallback: lolex.NodeTimer = nodeClock.requestIdleCallback(() => {}); +const nodeIdleCallbackWithTimeout: lolex.NodeTimer = nodeClock.requestIdleCallback(() => {}, 7); nodeTimeout.ref(); nodeTimeout.unref(); @@ -71,11 +75,15 @@ browserClock.clearTimeout(browserTimeout); browserClock.clearInterval(browserInterval); browserClock.clearImmediate(browserImmediate); browserClock.cancelAnimationFrame(browserAnimationFrame); +browserClock.cancelIdleCallback(browserIdleCallback); +browserClock.cancelIdleCallback(browserIdleCallbackWithTimeout); nodeClock.clearTimeout(nodeTimeout); nodeClock.clearInterval(nodeInterval); nodeClock.clearImmediate(nodeImmediate); nodeClock.cancelAnimationFrame(nodeAnimationFrame); +nodeClock.cancelIdleCallback(nodeIdleCallback); +nodeClock.cancelIdleCallback(nodeIdleCallbackWithTimeout); browserClock.tick(7); browserClock.tick("08"); diff --git a/types/make-dir/index.d.ts b/types/make-dir/index.d.ts deleted file mode 100644 index 1805280240..0000000000 --- a/types/make-dir/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -// Type definitions for make-dir 1.0 -// Project: https://github.com/sindresorhus/make-dir -// Definitions by: Ika -// BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 - -/// -import * as fs from 'fs'; - -export = makeDir; - -/** - * Returns a `Promise` for the path to the created directory. - * @param path Directory to create. - */ -declare function makeDir(path: string, options?: makeDir.Options): Promise; - -declare namespace makeDir { - /** - * Returns the path to the created directory. - * @param path Directory to create. - */ - function sync(path: string, options?: Options): string; - - interface Options { - /** - * Default: `0o777 & (~process.umask())` - * - * Directory [permissions](https://x-team.com/blog/file-system-permissions-umask-node-js/). - */ - mode?: number; - - /** - * Default: `require('fs')` - * - * Use a custom `fs` implementation. For example [`graceful-fs`](https://github.com/isaacs/node-graceful-fs). - */ - fs?: typeof fs; - } -} diff --git a/types/make-dir/make-dir-tests.ts b/types/make-dir/make-dir-tests.ts deleted file mode 100644 index 2767706bf6..0000000000 --- a/types/make-dir/make-dir-tests.ts +++ /dev/null @@ -1,13 +0,0 @@ -import makeDir = require('make-dir'); -import * as fs from 'fs'; -import * as gfs from 'graceful-fs'; - -makeDir('path/to/somewhere').then(dirname => { - // do something -}); - -const dirname = makeDir.sync('path/to/somewhere'); - -makeDir('path/to/somewhere', {mode: parseInt('777', 8)}); -makeDir('path/to/somewhere', {fs}); -makeDir('path/to/somewhere', {fs: gfs}); diff --git a/types/marked/index.d.ts b/types/marked/index.d.ts index 818620bb5e..74dfec5317 100644 --- a/types/marked/index.d.ts +++ b/types/marked/index.d.ts @@ -114,6 +114,15 @@ declare namespace marked { br(): string; } + class Parser { + constructor(options?: MarkedOptions); + parse(src: TokensList): string; + next(): Token; + peek(): Token | number; + parseText(): string; + tok(): string; + } + class Lexer { rules: Rules; tokens: TokensList; diff --git a/types/marked/marked-tests.ts b/types/marked/marked-tests.ts index 0abfb48efb..2af775e397 100644 --- a/types/marked/marked-tests.ts +++ b/types/marked/marked-tests.ts @@ -51,3 +51,8 @@ renderer.heading = (text, level, raw, slugger) => { const textRenderer = new marked.TextRenderer(); console.log(textRenderer.strong(text)); + +const parseTestText = "- list1\n - list1.1\n\n listend"; +const parseTestTokens: marked.TokensList = marked.lexer(parseTestText, options); +const parser = new marked.Parser(); +console.log(parser.parse(parseTestTokens)); diff --git a/types/moment-timezone/index.d.ts b/types/moment-timezone/index.d.ts index 95a8621fdd..8824a165d6 100644 --- a/types/moment-timezone/index.d.ts +++ b/types/moment-timezone/index.d.ts @@ -3,67 +3,9 @@ // Definitions by: Michel Salib // Alan Brazil Lins // Agustin Carrasco +// Borys Kupar // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import moment = require('moment'); +import moment = require('./moment-timezone'); -// require("moment-timezone") === require("moment") export = moment; - -declare module "moment" { - interface MomentZone { - name: string; - abbrs: string[]; - untils: number[]; - offsets: number[]; - population: number; - - abbr(timestamp: number): string; - offset(timestamp: number): number; - utcOffset(timestamp: number): number; - parse(timestamp: number): number; - } - - interface MomentTimezone { - (): moment.Moment; - (timezone: string): moment.Moment; - (date: number, timezone: string): moment.Moment; - (date: number[], timezone: string): moment.Moment; - (date: string, timezone: string): moment.Moment; - (date: string, format: moment.MomentFormatSpecification, timezone: string): moment.Moment; - (date: string, format: moment.MomentFormatSpecification, strict: boolean, timezone: string): moment.Moment; - (date: string, format: moment.MomentFormatSpecification, language: string, timezone: string): moment.Moment; - (date: string, format: moment.MomentFormatSpecification, language: string, strict: boolean, timezone: string): moment.Moment; - (date: Date, timezone: string): moment.Moment; - (date: moment.Moment, timezone: string): moment.Moment; - (date: any, timezone: string): moment.Moment; - - zone(timezone: string): MomentZone | null; - - add(packedZoneString: string): void; - add(packedZoneString: string[]): void; - - link(packedLinkString: string): void; - link(packedLinkString: string[]): void; - - load(data: { - version: string; - links: string[]; - zones: string[]; - }): void; - - names(): string[]; - guess(ignoreCache?: boolean): string; - - setDefault(timezone?: string): MomentTimezone; - } - - interface Moment { - tz(): string | undefined; - tz(timezone: string, keepLocalTime?: boolean): moment.Moment; - zoneAbbr(): string; - zoneName(): string; - } - - const tz: MomentTimezone; -} diff --git a/types/moment-timezone/moment-timezone.d.ts b/types/moment-timezone/moment-timezone.d.ts new file mode 100644 index 0000000000..71da391ffa --- /dev/null +++ b/types/moment-timezone/moment-timezone.d.ts @@ -0,0 +1,58 @@ +import moment = require('moment'); + +// require("moment-timezone") === require("moment") +export = moment; + +declare module 'moment' { + interface MomentZone { + name: string; + abbrs: string[]; + untils: number[]; + offsets: number[]; + population: number; + + abbr(timestamp: number): string; + offset(timestamp: number): number; + utcOffset(timestamp: number): number; + parse(timestamp: number): number; + } + + interface MomentTimezone { + (): moment.Moment; + (timezone: string): moment.Moment; + (date: number, timezone: string): moment.Moment; + (date: number[], timezone: string): moment.Moment; + (date: string, timezone: string): moment.Moment; + (date: string, format: moment.MomentFormatSpecification, timezone: string): moment.Moment; + (date: string, format: moment.MomentFormatSpecification, strict: boolean, timezone: string): moment.Moment; + (date: string, format: moment.MomentFormatSpecification, language: string, timezone: string): moment.Moment; + (date: string, format: moment.MomentFormatSpecification, language: string, strict: boolean, timezone: string): moment.Moment; + (date: Date, timezone: string): moment.Moment; + (date: moment.Moment, timezone: string): moment.Moment; + (date: any, timezone: string): moment.Moment; + + zone(timezone: string): MomentZone | null; + + add(packedZoneString: string): void; + add(packedZoneString: string[]): void; + + link(packedLinkString: string): void; + link(packedLinkString: string[]): void; + + load(data: { version: string; links: string[]; zones: string[] }): void; + + names(): string[]; + guess(ignoreCache?: boolean): string; + + setDefault(timezone?: string): MomentTimezone; + } + + interface Moment { + tz(): string | undefined; + tz(timezone: string, keepLocalTime?: boolean): moment.Moment; + zoneAbbr(): string; + zoneName(): string; + } + + const tz: MomentTimezone; +} diff --git a/types/moment-timezone/tsconfig.json b/types/moment-timezone/tsconfig.json index 62cbfb4214..5b29fa3ff5 100644 --- a/types/moment-timezone/tsconfig.json +++ b/types/moment-timezone/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "moment-timezone-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/mongo-sanitize/index.d.ts b/types/mongo-sanitize/index.d.ts index 44c5d04a7d..cf187384a4 100644 --- a/types/mongo-sanitize/index.d.ts +++ b/types/mongo-sanitize/index.d.ts @@ -1,9 +1,9 @@ // Type definitions for mongo-sanitize 1.0 // Project: https://github.com/vkarpov15/mongo-sanitize -// Definitions by: Cedric Cazin +// Definitions by: Cedric Cazin , Olga Isakova // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.7 -export function sanitize(v: T): T; +declare function sanitize(v: T): T; -export as namespace mongoSanitize; +export = sanitize; diff --git a/types/mongo-sanitize/mongo-sanitize-tests.ts b/types/mongo-sanitize/mongo-sanitize-tests.ts index 4d4534bbeb..3f86dc256e 100644 --- a/types/mongo-sanitize/mongo-sanitize-tests.ts +++ b/types/mongo-sanitize/mongo-sanitize-tests.ts @@ -1,11 +1,11 @@ -import * as mongoSanitize from 'mongo-sanitize'; +import sanitize from "mongo-sanitize"; -const objectSanitized = mongoSanitize.sanitize({ $gt: 5, a: 1 }); +const objectSanitized = sanitize({ $gt: 5, a: 1 }); -const arraySanitized = mongoSanitize.sanitize([1, 2, 3]); +const arraySanitized = sanitize([1, 2, 3]); class Clazz { $gt = 5; a = 1; } -const classSanitized = mongoSanitize.sanitize(new Clazz()); +const classSanitized = sanitize(new Clazz()); diff --git a/types/mongodb/index.d.ts b/types/mongodb/index.d.ts index 79da3d5ead..230f593094 100644 --- a/types/mongodb/index.d.ts +++ b/types/mongodb/index.d.ts @@ -876,17 +876,8 @@ export interface Collection { findOne(filter: FilterQuery, options: FindOneOptions, callback: MongoCallback): void; /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#findOneAndDelete */ findOneAndDelete(filter: FilterQuery, callback: MongoCallback>): void; - findOneAndDelete(filter: FilterQuery, options?: { projection?: object, sort?: object, maxTimeMS?: number, session?: ClientSession }): Promise>; - findOneAndDelete( - filter: FilterQuery, - options: { - projection?: object, - sort?: object, - maxTimeMS?: number, - session?: ClientSession - }, - callback: MongoCallback> - ): void; + findOneAndDelete(filter: FilterQuery, options?: FindOneAndDeleteOption): Promise>; + findOneAndDelete(filter: FilterQuery, options: FindOneAndDeleteOption, callback: MongoCallback>): void; /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#findOneAndReplace */ findOneAndReplace(filter: FilterQuery, replacement: object, callback: MongoCallback>): void; findOneAndReplace(filter: FilterQuery, replacement: object, options?: FindOneAndReplaceOption): Promise>; @@ -1317,7 +1308,7 @@ export interface CollectionAggregationOptions { * Allow driver to bypass schema validation in MongoDB 3.2 or higher. */ bypassDocumentValidation?: boolean; - hint?: string | object; + hint?: string | object; raw?: boolean; promoteLongs?: boolean; promoteValues?: boolean; @@ -1432,6 +1423,7 @@ export interface FindOneAndReplaceOption extends CommonOptions { maxTimeMS?: number; upsert?: boolean; returnOriginal?: boolean; + collation?: CollationDocument; } /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#findOneAndUpdate */ @@ -1439,6 +1431,15 @@ export interface FindOneAndUpdateOption extends FindOneAndReplaceOption { arrayFilters?: object[]; } +/** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#findOneAndDelete */ +export interface FindOneAndDeleteOption { + projection?: object; + sort?: object; + maxTimeMS?: number; + session?: ClientSession; + collation?: CollationDocument; +} + /** http://mongodb.github.io/node-mongodb-native/3.1/api/Collection.html#geoHaystackSearch */ export interface GeoHaystackSearchOptions { readPreference?: ReadPreference | string; @@ -1847,9 +1848,9 @@ export type CommandCursorResult = object | null; /** http://mongodb.github.io/node-mongodb-native/3.1/api/CommandCursor.html */ export class CommandCursor extends Readable { /** http://mongodb.github.io/node-mongodb-native/3.1/api/CommandCursor.html#hasNext */ - hasNext(): Promise; + hasNext(): Promise; /** http://mongodb.github.io/node-mongodb-native/3.1/api/CommandCursor.html#hasNext */ - hasNext(callback: MongoCallback): void; + hasNext(callback: MongoCallback): void; /** http://mongodb.github.io/node-mongodb-native/3.1/api/CommandCursor.html#batchSize */ batchSize(value: number): CommandCursor; /** http://mongodb.github.io/node-mongodb-native/3.1/api/CommandCursor.html#clone */ diff --git a/types/move-file/index.d.ts b/types/move-file/index.d.ts deleted file mode 100644 index 7c86feca71..0000000000 --- a/types/move-file/index.d.ts +++ /dev/null @@ -1,20 +0,0 @@ -// Type definitions for move-file 1.0 -// Project: https://github.com/sindresorhus/move-file#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = moveFile; - -declare function moveFile( - source: string, - destination: string, - options?: moveFile.Options -): Promise; - -declare namespace moveFile { - function sync(source: string, destination: string, options?: Options): void; - - interface Options { - overwrite?: boolean; - } -} diff --git a/types/move-file/move-file-tests.ts b/types/move-file/move-file-tests.ts deleted file mode 100644 index 36badd38c1..0000000000 --- a/types/move-file/move-file-tests.ts +++ /dev/null @@ -1,10 +0,0 @@ -import moveFile = require('move-file'); - -// $ExpectType Promise -moveFile('source/unicorn.png', 'destination/unicorn.png'); -// $ExpectType Promise -moveFile('source/unicorn.png', 'destination/unicorn.png', { overwrite: false }); -// $ExpectType void -moveFile.sync('source/unicorn.png', 'destination/unicorn.png'); -// $ExpectType void -moveFile.sync('source/unicorn.png', 'destination/unicorn.png', { overwrite: false }); diff --git a/types/mumath/clamp.d.ts b/types/mumath/clamp.d.ts new file mode 100644 index 0000000000..9d674a9620 --- /dev/null +++ b/types/mumath/clamp.d.ts @@ -0,0 +1,6 @@ +/** + * Detects proper clamp min/max. + */ +declare function clamp(value: number, left: number, right: number): number; + +export = clamp; diff --git a/types/mumath/closest.d.ts b/types/mumath/closest.d.ts new file mode 100644 index 0000000000..762bcb6548 --- /dev/null +++ b/types/mumath/closest.d.ts @@ -0,0 +1,6 @@ +/** + * Get closest value out of a set. + */ +declare function closest(value: number, list: number[]): number; + +export = closest; diff --git a/types/mumath/index.d.ts b/types/mumath/index.d.ts index 8967bafa4f..ee0f0ff6c6 100644 --- a/types/mumath/index.d.ts +++ b/types/mumath/index.d.ts @@ -2,62 +2,17 @@ // Project: https://github.com/dfcreative/mumath // Definitions by: Adam Zerella // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.3 -/** - * Detects proper clamp min/max. - */ -export function clamp(value: number, left: number, right: number): number; +import clamp = require('./clamp'); +import closest = require('./closest'); +import isMultiple = require('./isMultiple'); +import len = require('./len'); +import lerp = require('./lerp'); +import mod = require('./mod'); +import order = require('./order'); +import precision = require('./precision'); +import round = require('./round'); +import scale = require('./scale'); +import within = require('./within'); -/** - * Get closest value out of a set. - */ -export function closest(value: number, list: number[]): number; - -/** - * Check if one number is multiple of other - * Same as a % b === 0, but with precision check. - */ -export function isMultiple(a: number, b: number, eps?: number): boolean; - -/** - * Return quadratic length of a vector. - */ -export function len(a: number, b: number): number; - -/** - * Return value interpolated between x and y. - */ -export function lerp(x: number, y: number, ratio: number): number; - -/** - * An enhanced mod-loop, like fmod — loops value within a frame. - */ -export function mod(value: number, max: number, min?: number): number; - -/** - * Get order of magnitude for a number. - */ -export function order(value: number): number; - -/** - * Get precision from float: - */ -export function precision(value: number): number; - -/** - * Rounds value to optional step. - */ -export function round(value: number, step?: number): number; - -/** - * Get first scale out of a list of basic scales, aligned to the power. E. g. - * step(.37, [1, 2, 5]) → .5 step(456, [1, 2]) → 1000 - * Similar to closest, but takes all possible powers of scales. - */ -export function scale(value: number, list: number[]): number; - -/** - * Whether element is between left & right, including. - */ -export function within(value: number, left: number, right: number): number; +export { clamp, closest, isMultiple, len, lerp, mod, order, precision, round, scale, within }; diff --git a/types/mumath/isMultiple.d.ts b/types/mumath/isMultiple.d.ts new file mode 100644 index 0000000000..31c7a09b08 --- /dev/null +++ b/types/mumath/isMultiple.d.ts @@ -0,0 +1,7 @@ +/** + * Check if one number is multiple of other + * Same as a % b === 0, but with precision check. + */ +declare function isMultiple(a: number, b: number, eps?: number): boolean; + +export = isMultiple; diff --git a/types/mumath/len.d.ts b/types/mumath/len.d.ts new file mode 100644 index 0000000000..b2fae8a8e5 --- /dev/null +++ b/types/mumath/len.d.ts @@ -0,0 +1,6 @@ +/** + * Return quadratic length of a vector. + */ +declare function len(a: number, b: number): number; + +export = len; diff --git a/types/mumath/lerp.d.ts b/types/mumath/lerp.d.ts new file mode 100644 index 0000000000..5e09370be2 --- /dev/null +++ b/types/mumath/lerp.d.ts @@ -0,0 +1,6 @@ +/** + * Return value interpolated between x and y. + */ +declare function lerp(x: number, y: number, ratio: number): number; + +export = lerp; diff --git a/types/mumath/mod.d.ts b/types/mumath/mod.d.ts new file mode 100644 index 0000000000..ac1784fe06 --- /dev/null +++ b/types/mumath/mod.d.ts @@ -0,0 +1,6 @@ +/** + * An enhanced mod-loop, like fmod — loops value within a frame. + */ +declare function mod(value: number, max: number, min?: number): number; + +export = mod; diff --git a/types/mumath/mumath-tests.ts b/types/mumath/mumath-tests.ts index c0fed04336..a5b339b2fe 100644 --- a/types/mumath/mumath-tests.ts +++ b/types/mumath/mumath-tests.ts @@ -1,25 +1,48 @@ -import * as mumath from "mumath"; +import mumath = require("mumath"); + +import mumathClamp = require("mumath/clamp"); +import mumathClosest = require("mumath/closest"); +import mumathIsMultiple = require("mumath/isMultiple"); +import mumathLen = require("mumath/len"); +import mumathLerp = require("mumath/lerp"); +import mumathMod = require("mumath/mod"); +import mumathOrder = require("mumath/order"); +import mumathPrecision = require("mumath/precision"); +import mumathRound = require("mumath/round"); +import mumathScale = require("mumath/scale"); +import mumathWithin = require("mumath/within"); mumath.clamp(1, 2, 3); +mumathClamp(1, 2, 3); mumath.closest(5, [1, 7, 3, 6, 10]); +mumathClosest(5, [1, 7, 3, 6, 10]); mumath.isMultiple(5, 10, 1.000074); mumath.isMultiple(5, 10); +mumathIsMultiple(5, 10, 1.000074); mumath.len(15, 1.0); +mumathLen(15, 1.0); mumath.lerp(1, 2, 3); +mumathLerp(1, 2, 3); mumath.mod(1, 2, 3); mumath.mod(1, 2); +mumathMod(1, 2, 3); mumath.order(5); +mumathOrder(5); mumath.precision(5.0000001); +mumathPrecision(5.0000001); mumath.round(0.3, 0.5); +mumathRound(0.3, 0.5); mumath.scale(5.93, [1.0, 35, 10, 7.135]); +mumathScale(5.93, [1.0, 35, 10, 7.135]); mumath.within(5, 1, 10); +mumathWithin(5, 1, 10); diff --git a/types/mumath/order.d.ts b/types/mumath/order.d.ts new file mode 100644 index 0000000000..8ce4c396fa --- /dev/null +++ b/types/mumath/order.d.ts @@ -0,0 +1,6 @@ +/** + * Get order of magnitude for a number. + */ +declare function order(value: number): number; + +export = order; diff --git a/types/mumath/precision.d.ts b/types/mumath/precision.d.ts new file mode 100644 index 0000000000..1b1a7290cc --- /dev/null +++ b/types/mumath/precision.d.ts @@ -0,0 +1,6 @@ +/** + * Get precision from float: + */ +declare function precision(value: number): number; + +export = precision; diff --git a/types/mumath/round.d.ts b/types/mumath/round.d.ts new file mode 100644 index 0000000000..8966dc6068 --- /dev/null +++ b/types/mumath/round.d.ts @@ -0,0 +1,6 @@ +/** + * Rounds value to optional step. + */ +declare function round(value: number, step?: number): number; + +export = round; diff --git a/types/mumath/scale.d.ts b/types/mumath/scale.d.ts new file mode 100644 index 0000000000..2cb97bcb4f --- /dev/null +++ b/types/mumath/scale.d.ts @@ -0,0 +1,8 @@ +/** + * Get first scale out of a list of basic scales, aligned to the power. E. g. + * step(.37, [1, 2, 5]) → .5 step(456, [1, 2]) → 1000 + * Similar to closest, but takes all possible powers of scales. + */ +declare function scale(value: number, list: number[]): number; + +export = scale; diff --git a/types/mumath/tsconfig.json b/types/mumath/tsconfig.json index 67aa9c2b29..e96b912780 100644 --- a/types/mumath/tsconfig.json +++ b/types/mumath/tsconfig.json @@ -20,6 +20,17 @@ }, "files": [ "index.d.ts", + "clamp.d.ts", + "closest.d.ts", + "isMultiple.d.ts", + "len.d.ts", + "lerp.d.ts", + "mod.d.ts", + "order.d.ts", + "precision.d.ts", + "round.d.ts", + "scale.d.ts", + "within.d.ts", "mumath-tests.ts" ] } diff --git a/types/mumath/within.d.ts b/types/mumath/within.d.ts new file mode 100644 index 0000000000..f1d7e56cbd --- /dev/null +++ b/types/mumath/within.d.ts @@ -0,0 +1,6 @@ +/** + * Whether element is between left & right, including. + */ +declare function within(value: number, left: number, right: number): number; + +export = within; diff --git a/types/node-dogstatsd/index.d.ts b/types/node-dogstatsd/index.d.ts index 8e818f7cb6..9f3c56dff9 100644 --- a/types/node-dogstatsd/index.d.ts +++ b/types/node-dogstatsd/index.d.ts @@ -4,7 +4,10 @@ // Michael Mifsud // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + declare module "node-dogstatsd" { + import * as dgram from 'dgram'; export interface StatsDOptions { global_tags?: string[]; @@ -25,7 +28,9 @@ declare module "node-dogstatsd" { } export class StatsD implements StatsDClient { - constructor(host: string, port?: number, socket?: string, options?: StatsDOptions); + public socket: dgram.Socket + + constructor(host: string, port?: number, socket?: dgram.Socket, options?: StatsDOptions); timing(stat: string, time: number, sample_rate?: number, tags?: string[]): void; diff --git a/types/node-dogstatsd/node-dogstatsd-tests.ts b/types/node-dogstatsd/node-dogstatsd-tests.ts index 072c5b168e..949ed73eac 100644 --- a/types/node-dogstatsd/node-dogstatsd-tests.ts +++ b/types/node-dogstatsd/node-dogstatsd-tests.ts @@ -1,12 +1,14 @@ +import * as dgram from 'dgram'; import * as datadog from 'node-dogstatsd'; function test_statsd_client() { // can create client with defaults let client = new datadog.StatsD('localhost'); let options: datadog.StatsDOptions = { global_tags: ['environment:definitely_typed']}; + const socket: dgram.Socket = dgram.createSocket('udp4'); // can create client with all params - client = new datadog.StatsD('localhost', 8125, null, options); + client = new datadog.StatsD('localhost', 8125, socket, options); let key: string = 'key'; let timeValue: number = 99; diff --git a/types/node-notifier/index.d.ts b/types/node-notifier/index.d.ts index dad13583b9..7846a9b246 100644 --- a/types/node-notifier/index.d.ts +++ b/types/node-notifier/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for node-notifier +// Type definitions for node-notifier 5.4.0 // Project: https://github.com/mikaelbr/node-notifier // Definitions by: Qubo +// Lorenzo Rapetti // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -14,12 +15,30 @@ declare module "node-notifier" { namespace nodeNotifier { interface NodeNotifier extends NodeJS.EventEmitter { + notify( + notification?: NotificationCenter.Notification, + callback?: NotificationCallback + ): NotificationCenter; + notify( + notification?: WindowsToaster.Notification, + callback?: NotificationCallback + ): WindowsToaster; + notify( + notification?: WindowsBalloon.Notification, + callback?: NotificationCallback + ): WindowsBalloon; + notify( + notification?: NotifySend.Notification, + callback?: NotificationCallback + ): NotifySend; + notify(notification?: Growl.Notification, callback?: NotificationCallback): Growl; notify(notification?: Notification, callback?: NotificationCallback): NodeNotifier; - NotificationCenter: NotificationCenter; - NotifySend: NotifySend; - WindowsToaster: WindowsToaster; - WindowsBalloon: WindowsBalloon; - Growl: Growl; + notify(notification?: string, callback?: NotificationCallback): NodeNotifier; + NotificationCenter: typeof NotificationCenter; + NotifySend: typeof NotifySend; + WindowsToaster: typeof WindowsToaster; + WindowsBalloon: typeof WindowsBalloon; + Growl: typeof Growl; } interface Notification { @@ -27,15 +46,25 @@ declare module "node-notifier" { message?: string; /** Absolute path (not balloons) */ icon?: string; - /** Only Notification Center or Windows Toasters */ - sound?: boolean; /** Wait with callback until user action is taken on notification */ wait?: boolean; } - interface NotificationCallback { - (err: any, response: any): any; - } + interface NotificationMetadata { + activationType?: string; + activationAt?: string; + deliveredAt?: string; + activationValue?: string; + activationValueIndex?: string; + } + + interface NotificationCallback { + ( + err: Error | null, + response: string, + metadata?: NotificationMetadata, + ): void; + } interface Option { withFallback?: boolean; @@ -58,11 +87,31 @@ declare module "node-notifier/notifiers/notificationcenter" { namespace NotificationCenter { interface Notification extends notifier.Notification { + /** + * Case Sensitive string for location of sound file, or use one of macOS' native sounds. + */ + sound?: boolean | string; subtitle?: string; /** Attach image? (Absolute path) */ contentImage?: string; /** URL to open on click */ open?: string; + /** + * The amount of seconds before the notification closes. + * Takes precedence over wait if both are defined. + */ + timeout?: number; + /** Label for cancel button */ + closeLabel?: string; + /** Action label or list of labels in case of dropdown. */ + actions?: string | string[]; + /** Label to be used if there are multiple actions */ + dropdownLabel?: string; + /** + * If notification should take input. + * Value passed as third argument in callback and event emitter. + */ + reply?: boolean; } } @@ -101,7 +150,27 @@ declare module "node-notifier/notifiers/toaster" { class WindowsToaster { constructor(option?: notifier.Option); - notify(notification?: notifier.Notification, callback?: notifier.NotificationCallback): WindowsToaster; + notify(notification?: WindowsToaster.Notification, callback?: notifier.NotificationCallback): WindowsToaster; + } + + namespace WindowsToaster { + interface Notification extends notifier.Notification { + /** + * Defined by http://msdn.microsoft.com/en-us/library/windows/apps/hh761492.aspx + */ + sound?: boolean | string; + /** ID to use for closing notification. */ + id?: number; + /** App.ID and app Name. Defaults to no value, causing SnoreToast text to be visible. */ + appID?: string; + /** Refer to previously created notification to close. */ + remove?: number; + /** + * Creates a shortcut in the start menu which point to the + * executable , appID used for the notifications. + */ + install?: string; + } } export = WindowsToaster; @@ -122,19 +191,13 @@ declare module "node-notifier/notifiers/growl" { port?: number; } - interface Notification { - title?: string; - message?: string; - /** Absolute path (not balloons) */ - icon?: string; - /** Wait with callback until user action is taken on notification */ - wait?: boolean; + interface Notification extends notifier.Notification { /** whether or not to sticky the notification (defaults to false) */ - sticky?: boolean; + sticky?: boolean; /** type of notification to use (defaults to the first registered type) */ - label: string; + label?: string; /** the priority of the notification from lowest (-2) to highest (2) */ - priority: number; + priority?: number; } } @@ -153,12 +216,12 @@ declare module "node-notifier/notifiers/balloon" { interface Notification { title?: string; message?: string; - /** Only Notification Center or Windows Toasters */ - sound?: boolean; /** How long to show balloons in ms */ time?: number; /** Wait with callback until user action is taken on notification */ wait?: boolean; + /** The notification type */ + type?: 'info' | 'warn' | 'error'; } } diff --git a/types/node-notifier/node-notifier-tests.ts b/types/node-notifier/node-notifier-tests.ts index 7e6ce74c14..6162196c86 100644 --- a/types/node-notifier/node-notifier-tests.ts +++ b/types/node-notifier/node-notifier-tests.ts @@ -4,6 +4,8 @@ import notifier = require('node-notifier'); import * as path from 'path'; +notifier.notify(); +notifier.notify('Hello there'); notifier.notify({ title: 'My awesome title', message: 'Hello from node, Mr. User!', @@ -22,8 +24,8 @@ notifier.on('timeout', function (notifierObject: any, options: any) { // Happens if `wait: true` and notification closes }); -const options = { }; +const options = { }; import NotificationCenter = require('node-notifier/notifiers/notificationcenter'); new NotificationCenter(options).notify(); @@ -41,35 +43,38 @@ import WindowsBalloon = require('node-notifier/notifiers/balloon'); new WindowsBalloon(options).notify(); -var nn = require('node-notifier'); - -new nn.NotificationCenter(options).notify(); -new nn.NotifySend(options).notify(); -new nn.WindowsToaster(options).notify(options); -new nn.WindowsBalloon(options).notify(options); -new nn.Growl(options).notify(options); +new notifier.NotificationCenter(options).notify(); +new notifier.NotifySend(options).notify(); +new notifier.WindowsToaster(options).notify(options); +new notifier.WindowsBalloon(options).notify(options); +new notifier.Growl(options).notify(options); // // All notification options with their defaults: // -var NotificationCenter2 = require('node-notifier').NotificationCenter; +const NotificationCenter2 = notifier.NotificationCenter; -var notifier2 = new NotificationCenter2({ +const notifier2 = new NotificationCenter2({ withFallback: false, // use Growl if <= 10.8? customPath: void 0 // Relative path if you want to use your fork of terminal-notifier }); notifier2.notify({ - 'title': void 0, - 'subtitle': void 0, - 'message': void 0, - 'sound': false, // Case Sensitive string of sound file (see below) - 'icon': 'Terminal Icon', // Set icon? (Absolute path to image) - 'contentImage': void 0, // Attach image? (Absolute path) - 'open': void 0, // URL to open on click - 'wait': false // if wait for notification to end + title: void 0, + subtitle: void 0, + message: void 0, + sound: false, // Case Sensitive string of sound file (see below) + icon: 'Terminal Icon', // Set icon? (Absolute path to image) + contentImage: void 0, // Attach image? (Absolute path) + open: void 0, // URL to open on click + wait: false, // if wait for notification to end + actions: ['Action 1', 'Action 2'], + closeLabel: 'Close', + dropdownLabel: 'Dropdown', + reply: true, + timeout: 10 }, function(error: any, response: any) { console.log(response); }); @@ -78,9 +83,9 @@ notifier2.notify({ // Usage WindowsToaster // -var WindowsToaster2 = require('node-notifier').WindowsToaster; +const WindowsToaster2 = notifier.WindowsToaster; -var notifier3 = new WindowsToaster2({ +const notifier3 = new WindowsToaster2({ withFallback: false, // Fallback to Growl or Balloons? customPath: void 0 // Relative path if you want to use your fork of toast.exe }); @@ -91,6 +96,10 @@ notifier3.notify({ icon: void 0, // absolute path to an icon sound: false, // true | false. wait: false, // if wait for notification to end + appID: '', + id: 1, + install: '/', + remove: 1 }, function(error: any, response: any) { console.log(response); }); diff --git a/types/node/globals.d.ts b/types/node/globals.d.ts index 210830f7e8..36726f5cc0 100644 --- a/types/node/globals.d.ts +++ b/types/node/globals.d.ts @@ -465,7 +465,17 @@ declare namespace NodeJS { showProxy?: boolean; maxArrayLength?: number | null; breakLength?: number; - compact?: boolean; + /** + * Setting this to `false` causes each object key + * to be displayed on a new line. It will also add new lines to text that is + * longer than `breakLength`. If set to a number, the most `n` inner elements + * are united on a single line as long as all properties fit into + * `breakLength`. Short array elements are also grouped together. Note that no + * text will be reduced below 16 characters, no matter the `breakLength` size. + * For more information, see the example below. + * @default `true` + */ + compact?: boolean | number; sorted?: boolean | ((a: string, b: string) => number); } diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 23b53a5f0d..498b54e52e 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for non-npm package Node.js 11.10 +// Type definitions for non-npm package Node.js 11.11 // Project: http://nodejs.org/ // Definitions by: Microsoft TypeScript // DefinitelyTyped @@ -64,6 +64,7 @@ interface WeakMapConstructor { } interface SetConstructor { } interface WeakSetConstructor { } interface Set {} +interface Map {} interface ReadonlySet {} interface IteratorResult { } interface Iterable { } diff --git a/types/node/test/util.ts b/types/node/test/util.ts index 252e8824ae..3af024972e 100644 --- a/types/node/test/util.ts +++ b/types/node/test/util.ts @@ -30,6 +30,9 @@ import { readFile } from 'fs'; sorted: true, getters: 'set', }); + util.inspect(["This is nice"], { + compact: 42, + }); assert(typeof util.inspect.custom === 'symbol'); util.formatWithOptions({ colors: true }, 'See object %O', { foo: 42 }); diff --git a/types/nodegit/commit.d.ts b/types/nodegit/commit.d.ts index 57e8c55d87..8152eb8a8d 100644 --- a/types/nodegit/commit.d.ts +++ b/types/nodegit/commit.d.ts @@ -25,7 +25,7 @@ export class Commit { static lookupPrefix(repo: Repository, id: Oid, len: number): Promise; static createWithSignature(repo: Repository, commitContent: string, signature: string, signatureField: string): Promise; - amend(updateRef: string, author: Signature, committer: Signature, messageEncoding: string, message: string, tree: Tree): Promise; + amend(updateRef: string, author: Signature, committer: Signature, messageEncoding: string, message: string, tree: Tree | Oid): Promise; author(): Signature; committer(): Signature; diff --git a/types/nodegit/diff.d.ts b/types/nodegit/diff.d.ts index 62de0de6c4..3a02577b98 100644 --- a/types/nodegit/diff.d.ts +++ b/types/nodegit/diff.d.ts @@ -132,17 +132,18 @@ export class Diff { * * */ - static blobToBuffer(oldBlob: Blob, oldAsPath: string, - buffer: string, bufferAsPath: string, opts: DiffOptions, fileCb: Function, binaryCb: Function, hunkCb: Function, lineCb: Function): Promise; + static blobToBuffer(oldBlob?: Blob, oldAsPath?: string, + buffer?: string, bufferAsPath?: string, opts?: DiffOptions, fileCb?: Function, + binaryCb?: Function, hunkCb?: Function, lineCb?: Function): Promise; static fromBuffer(content: string, contentLen: number): Promise; - static indexToWorkdir(repo: Repository, index: Index, opts?: DiffOptions): Promise; + static indexToWorkdir(repo: Repository, index?: Index, opts?: DiffOptions): Promise; static indexToIndex(repo: Repository, oldIndex: Index, newIndex: Index, opts?: DiffOptions): Promise; - static treeToIndex(repo: Repository, oldTree: Tree, index: Index, opts?: DiffOptions): Promise; - static treeToTree(repo: Repository, oldTree: Tree, new_tree: Tree, opts?: DiffOptions): Promise; - static treeToWorkdir(repo: Repository, oldTree: Tree, opts?: DiffOptions): Promise; - static treeToWorkdirWithIndex(repo: Repository, oldTree: Tree, opts?: DiffOptions): Promise; + static treeToIndex(repo: Repository, oldTree?: Tree, index?: Index, opts?: DiffOptions): Promise; + static treeToTree(repo: Repository, oldTree?: Tree, new_tree?: Tree, opts?: DiffOptions): Promise; + static treeToWorkdir(repo: Repository, oldTree?: Tree, opts?: DiffOptions): Promise; + static treeToWorkdirWithIndex(repo: Repository, oldTree?: Tree, opts?: DiffOptions): Promise; - findSimilar(options: DiffFindOptions): Promise; + findSimilar(options?: DiffFindOptions): Promise; getDelta(idx: number): DiffDelta; getPerfdata(): Promise; numDeltas(): number; diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 8f0dd811a0..c0e18853a6 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -1,6 +1,8 @@ // Type definitions for nodegit 0.24 // Project: https://github.com/nodegit/nodegit, http://nodegit.org -// Definitions by: Dolan Miu , Tobias Nießen +// Definitions by: Dolan Miu , +// Tobias Nießen , +// Pierre Vigier // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export { AnnotatedCommit } from './annotated-commit'; diff --git a/types/nodegit/reset.d.ts b/types/nodegit/reset.d.ts index 9051fa693b..ca7ff41e86 100644 --- a/types/nodegit/reset.d.ts +++ b/types/nodegit/reset.d.ts @@ -1,8 +1,9 @@ import { AnnotatedCommit } from './annotated-commit'; import { Repository } from './repository'; -import { Object } from './object'; import { Strarray } from './str-array'; import { CheckoutOptions } from './checkout-options'; +import { Commit } from './commit'; +import { Tag } from './tag'; export namespace Reset { const enum TYPE { @@ -16,11 +17,11 @@ export class Reset { /** * Look up a refs's commit. */ - static reset(repo: Repository, target: Object, resetType: number, checkoutOpts: CheckoutOptions): Promise; + static reset(repo: Repository, target: Commit | Tag, resetType: number, checkoutOpts: CheckoutOptions): Promise; /** * Look up a refs's commit. */ - static default(repo: Repository, target: Object, pathspecs: Strarray | string | string[]): Promise; + static default(repo: Repository, target: Commit | Tag, pathspecs: Strarray | string | string[]): Promise; /** * Sets the current head to the specified commit oid and optionally resets the index and working tree to match. * This behaves like reset but takes an annotated commit, which lets you specify which extended sha syntax string was specified by a user, allowing for more exact reflog messages. diff --git a/types/nodegit/revert.d.ts b/types/nodegit/revert.d.ts index 1f9d4a2677..df804cbb48 100644 --- a/types/nodegit/revert.d.ts +++ b/types/nodegit/revert.d.ts @@ -13,7 +13,7 @@ export interface RevertOptions { } export class Revert { - static revert(repo: Repository, commit: Commit, givenOpts: RevertOptions): Promise; + static revert(repo: Repository, commit: Commit, givenOpts?: RevertOptions): Promise; /** * Reverts the given commit against the given "our" commit, producing an index that reflects the result of the revert. */ diff --git a/types/nodegit/time.d.ts b/types/nodegit/time.d.ts index 575c005781..cb42ea6838 100644 --- a/types/nodegit/time.d.ts +++ b/types/nodegit/time.d.ts @@ -1,4 +1,4 @@ export class Time { - time: number; - offset: number; + time(): number; + offset(): number; } 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/oakdex-pokedex/tsconfig.json b/types/oakdex-pokedex/tsconfig.json new file mode 100644 index 0000000000..0934229423 --- /dev/null +++ b/types/oakdex-pokedex/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", + "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/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/ora/tslint.json b/types/offscreencanvas/tslint.json similarity index 100% rename from types/ora/tslint.json rename to types/offscreencanvas/tslint.json 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/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/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/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/pendo-io-browser/index.d.ts b/types/pendo-io-browser/index.d.ts new file mode 100644 index 0000000000..dfc04e25d4 --- /dev/null +++ b/types/pendo-io-browser/index.d.ts @@ -0,0 +1,167 @@ +// 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; + } + + type Metadata = Record; + + interface Visitor extends Metadata { + id: string; + } + + interface Account extends Metadata { + id?: string; + } + + 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(visitorMetadata: Metadata): 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; + 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..16db208cda --- /dev/null +++ b/types/pendo-io-browser/pendo-io-browser-tests.ts @@ -0,0 +1,77 @@ +// 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.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/ora/v0/tslint.json b/types/pendo-io-browser/tslint.json similarity index 100% rename from types/ora/v0/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/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/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/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/make-dir/tsconfig.json b/types/plurals-cldr/tsconfig.json similarity index 93% rename from types/make-dir/tsconfig.json rename to types/plurals-cldr/tsconfig.json index f1770d52af..593fbd1545 100644 --- a/types/make-dir/tsconfig.json +++ b/types/plurals-cldr/tsconfig.json @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "make-dir-tests.ts" + "plurals-cldr-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/ora/v1/tslint.json b/types/plurals-cldr/tslint.json similarity index 100% rename from types/ora/v1/tslint.json rename to types/plurals-cldr/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/ora/v1/tsconfig.json b/types/protocol-buffers-schema/tsconfig.json similarity index 60% rename from types/ora/v1/tsconfig.json rename to types/protocol-buffers-schema/tsconfig.json index ad30053dff..76e4087db4 100644 --- a/types/ora/v1/tsconfig.json +++ b/types/protocol-buffers-schema/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" + "parse.d.ts", + "stringify.d.ts", + "tokenize.d.ts", + "protocol-buffers-schema-tests.ts" ] } diff --git a/types/pkg-conf/tslint.json b/types/protocol-buffers-schema/tslint.json similarity index 100% rename from types/pkg-conf/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/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/puppeteer/index.d.ts b/types/puppeteer/index.d.ts index 1b9428392a..e043587e16 100644 --- a/types/puppeteer/index.d.ts +++ b/types/puppeteer/index.d.ts @@ -31,6 +31,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 { /** @@ -2187,6 +2189,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 +2231,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/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/ramda/index.d.ts b/types/ramda/index.d.ts index e1b1f21334..2124c0b928 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.2 /// /// @@ -275,6 +276,253 @@ /// /// /// +/// + +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// declare let R: R.Static; @@ -366,77 +614,6 @@ declare namespace R { never }; - // @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; - } - interface Placeholder { __isRamdaPlaceholder__: true; } interface Reduced { @@ -463,11 +640,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 +760,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 @@ -835,17 +1012,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 @@ -970,7 +1137,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. @@ -1444,7 +1611,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. @@ -1558,7 +1725,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. @@ -1727,7 +1894,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 +1902,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 @@ -2180,7 +2347,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 +2372,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 +2399,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 +2554,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. @@ -2581,7 +2748,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..fdac7648db 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 } } }; @@ -2784,3 +2791,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/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/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/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/memoize.d.ts b/types/ramda/src/memoize.d.ts new file mode 100644 index 0000000000..a32d4d0016 --- /dev/null +++ b/types/ramda/src/memoize.d.ts @@ -0,0 +1,2 @@ +import { memoize } from '../index'; +export default memoize; 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/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/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/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/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/react-big-calendar/index.d.ts b/types/react-big-calendar/index.d.ts index 7a6bebe1c2..85914eda10 100644 --- a/types/react-big-calendar/index.d.ts +++ b/types/react-big-calendar/index.d.ts @@ -120,6 +120,7 @@ export interface Components { 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?: { 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-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-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-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..3e133095de --- /dev/null +++ b/types/react-csv/components/Link.d.ts @@ -0,0 +1,5 @@ +import { Component } from "react"; +import { CommonPropTypes } from "./CommonPropTypes"; + +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..a099d60626 --- /dev/null +++ b/types/react-csv/react-csv-tests.tsx @@ -0,0 +1,77 @@ +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); 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-datepicker/index.d.ts b/types/react-datepicker/index.d.ts index ce7ebcfab9..c957411347 100644 --- a/types/react-datepicker/index.d.ts +++ b/types/react-datepicker/index.d.ts @@ -9,6 +9,7 @@ // Sean Kelley // Justin Grant // Jake Boone +// Roman Nuritdinov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -41,7 +42,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 +58,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 +113,7 @@ export interface ReactDatePickerProps { showTimeSelectOnly?: boolean; showWeekNumbers?: boolean; showYearDropdown?: boolean; - startDate?: Date; + startDate?: Date | null; startOpen?: boolean; tabIndex?: number; timeCaption?: string; diff --git a/types/react-datepicker/react-datepicker-tests.tsx b/types/react-datepicker/react-datepicker-tests.tsx index 9486d043eb..1188f53763 100644 --- a/types/react-datepicker/react-datepicker-tests.tsx +++ b/types/react-datepicker/react-datepicker-tests.tsx @@ -121,6 +121,14 @@ const defaultLocale = getDefaultLocale(); ; + 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-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-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..04c4d9aed9 100644 --- a/types/react-map-gl/index.d.ts +++ b/types/react-map-gl/index.d.ts @@ -226,6 +226,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; 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-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-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-redux/index.d.ts b/types/react-redux/index.d.ts index 624bc0b680..3ef1005cd8 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 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-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-table/index.d.ts b/types/react-table/index.d.ts index 6aad7c3c8c..c0c2a8fc25 100644 --- a/types/react-table/index.d.ts +++ b/types/react-table/index.d.ts @@ -51,12 +51,12 @@ export interface SortingRule { } export interface TableProps extends - Partial, - Partial, - Partial, - Partial, - Partial, - Partial { + TextProps, + ComponentDecoratorProps, + ControlledStateCallbackProps, + PivotingProps, + ControlledStateOverrideProps, + ComponentProps { /** Default: [] */ data: D[]; 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/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/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/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/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/on-change/tsconfig.json b/types/retinajs/tsconfig.json similarity index 94% rename from types/on-change/tsconfig.json rename to types/retinajs/tsconfig.json index 433629ab82..c022eaf6cc 100644 --- a/types/on-change/tsconfig.json +++ b/types/retinajs/tsconfig.json @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "on-change-tests.ts" + "retinajs-tests.ts" ] } diff --git a/types/zapier-platform-core/tslint.json b/types/retinajs/tslint.json similarity index 100% rename from types/zapier-platform-core/tslint.json rename to types/retinajs/tslint.json diff --git a/types/seen/index.d.ts b/types/seen/index.d.ts new file mode 100644 index 0000000000..7e2e90b51f --- /dev/null +++ b/types/seen/index.d.ts @@ -0,0 +1,795 @@ +// Type definitions for seen 0.2 +// Project: https://github.com/themadcreator/seen +// Definitions by: Adam Vernon +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// TypeScript Version: 2.1 + +/** + * The animator class is useful for creating an animation loop. We supply pre and post events for apply animation changes between frames. + */ +export class Animator { + dispatch: Events.Dispatcher; + timestamp: number; + frameDelay: number | null; + constructor(); + animateFrame(): this; + frame(t?: boolean): this; + onAfter(handler: FrameHandler): this; + onBefore(handler: FrameHandler): this; + onFrame(handler: FrameHandler): this; + start(): this; + stop(): this; +} + +export interface FrameHandler { + (timestamp: number, deltaTimestamp: number): void; +} + +/** + * The Bounds object contains an axis-aligned bounding box. + */ +export class Bounds { + constructor(); + add(p: Point): this; + center(): Point; + contains(p: Point): boolean; + copy(): this; + depth(): number; + height(): number; + intersect(box: Bounds): this; + maxX(): number; + maxY(): number; + maxZ(): number; + minX(): number; + minY(): number; + minZ(): number; + pad(x: number, y: number, z: number): this; + reset(): this; + valid(): boolean; + width(): number; + static points(points: Point[]): Bounds; + static xywh(x: number, y: number, w: number, h: number): Bounds; + static xyzwhd(x: number, y: number, z: number, w: number, h: number, d: number): Bounds; +} + +/** + * The Camera model contains all three major components of the 3D to 2D tranformation. + * + * First, we transform object from world-space (the same space that the coordinates of surface points are in after all their transforms are applied) to camera space. Typically, this will place all + * viewable objects into a cube with coordinates: x = -1 to 1, y = -1 to 1, z = 1 to 2 + * + * Second, we apply the projection trasform to create perspective parallax and what not. + * + * Finally, we rescale to the viewport size. + * + * These three steps allow us to easily create shapes whose coordinates match up to screen coordinates in the z = 0 plane. + */ +export class Camera extends Transformable { + projection: Matrix; + defaults: { projection: Matrix }; + constructor(transform?: Matrix); +} + +export class CanvasCirclePainter extends CanvasStyler { + circle(center: { x: number, y: number }, radius: number): CanvasCirclePainter; +} + +export class CanvasLayerRenderContext extends RenderLayerContext { + constructor(ctx: CanvasRenderingContext2D); + circle(): CanvasCirclePainter; + path(): CanvasPathPainter; + rect(): CanvasRectPainter; + text(): CanvasTextPainter; +} + +export class CanvasPathPainter extends CanvasStyler { + path(points: Point[]): this; +} + +export class CanvasRectPainter extends CanvasStyler { + rect(width: number, height: number): this; +} + +export class CanvasRenderContext extends RenderContext { + el: HTMLCanvasElement; + ctx: CanvasRenderingContext2D; + constructor(elementOrId: string | HTMLElement); + layer(layer: RenderLayerContext): this; + reset(): void; +} + +export class CanvasStyler { + constructor(ctx: CanvasRenderingContext2D); + draw(style?: { stroke?: string, 'stroke-width'?: number, 'text-anchor'?: string }): this; + fill(style?: { fill?: string, 'fill-opacity'?: number, 'text-anchor'?: string }): this; +} + +export class CanvasTextPainter { + constructor(ctx: CanvasRenderingContext2D); + fillText(m: Matrix, text: string, style?: { font: string, fill?: string, 'text-anchor'?: string }): this; +} + +/** + * Color objects store RGB and Alpha values from 0 to 255. + */ +export class Color { + r: number; + g: number; + b: number; + a: number; + constructor(r?: number, g?: number, b?: number, a?: number); + addChannels(c: Color): this; + clamp(min?: number, max?: number): this; + copy(): this; + hex(): string; + minChannels(c: Color): this; + multiplyChannels(c: Color): this; + offset(n: number): this; + scale(n: number): this; + style(): string; +} + +/** + * Adds simple mouse drag eventing to a DOM element. A ‘drag’ event is emitted as the user is dragging their mouse. This is the easiest way to add mouse- look or mouse-rotate to a scene. + */ +export class Drag { + el: HTMLElement; + inertia: boolean; + dispatch: Events.Dispatcher; + defaults: { inertia: boolean }; + constructor(elementOrId: string | HTMLElement, options?: { inertia?: boolean }); + on(type: string, listener: (e: { offset: number[], offsetRelative: number[] }) => void): Events.Dispatcher; +} + +export class FillLayer extends RenderLayer { + constructor(width: number, height: number, fill: string); + render(context: RenderLayerContext): void; +} + +export class Grad { + x: number; + y: number; + z: number; + constructor(x: number, y: number, z: number); + dot(x: number, y: number, z: number): number; +} + +/** + * A class for computing mouse interia for interial scrolling + */ +export class InertialMouse { + xy: number[]; + constructor(); + damp(): this; + get(): [number, number]; + reset(): this; + update(xy: [number, number]): this; + static inertiaExtinction: number; + static inertiaMsecDelay: number; + static smoothingTimeout: number; +} + +export interface LightOptions { + point?: Point; + color?: Color; + intensity?: number; + normal?: Point; + enabled?: boolean; +} + +/** + * This model object holds the attributes and transformation of a light source. + */ +export class Light extends Transformable { + type: string; + point: Point; + color: Color; + intensity: number; + normal: Point; + enabled: boolean; + id: string; + defaults: LightOptions; + constructor(type: 'point' | 'directional' | 'ambient', options?: LightOptions); + render(): void; +} + +/** + * The LightRenderModel stores pre-computed values necessary for shading surfaces with the supplied Light. + */ +export class LightRenderModel { + colorIntensity: Color; + type: string; + intensity: number; + point: Point; + origin: Point; + normal: Point; + constructor(light: Light, transform: Matrix); +} + +export interface MaterialOptions { + color?: Color; + metallic?: boolean; + specularColor?: Color; + specularExponent?: number; + shader?: Shader; +} + +/** + * Material objects hold the attributes that desribe the color and finish of a surface. + */ +export class Material { + color: Color; + metallic: boolean; + specularColor: Color; + specularExponent: number; + shader: Shader; + defaults: MaterialOptions; + constructor(color?: Color, options?: MaterialOptions); + render(lights?: Light[], shader?: Shader, renderData?: RenderModel): Color; + static create(value?: Material | Color | string): Material; +} + +/** + * The Matrix class stores transformations in the scene. These include: (1) Camera Projection and Viewport transformations. (2) Transformations of any Transformable type object, such as Shapes or + * Models + * + * Most of the methods on Matrix are destructive, so be sure to use .copy() when you want to preserve an object’s value. + */ +export class Matrix { + m: number[]; + baked: number[]; + constructor(m?: number[]); + bake(m?: number[]): this; + copy(): this; + matrix(m: number[]): this; + multiply(b: Matrix): this; + reset(): this; + rotx(theta: number): this; + roty(theta: number): this; + rotz(theta: number): this; + scale(x?: number, y?: number, z?: number): this; + translate(x?: number, y?: number, z?: number): this; + transpose(): this; +} + +export class Mocap { + bvh: any; + constructor(bvh?: any); + createMocapModel(shapeFactory?: () => Shape): MocapModel; + static DEFAULT_SHAPE_FACTORY(joint?: any, endpoint?: Point): Shape; + static parse(source: string): Mocap; +} + +export class MocapAnimator extends Animator { + constructor(mocap: MocapModel); + renderFrame(): void; +} + +export class MocapModel { + constructor(model: Model, frames: any[], frameDelay?: number); + applyFrameTransforms(frameIndex: number): number; +} + +/** + * The object model class. It stores Shapes, Lights, and other Models as well as a transformation matrix. + * + * Notably, models are hierarchical, like a tree. This means you can isolate the transformation of groups of shapes in the scene, as well as create chains of transformations for creating, for + * example, articulated skeletons. + */ +export class Model extends Transformable { + constructor(); + add(...args: Array): this; + append(): this; + eachRenderable(lightFn: (light: Light, matrix?: Matrix) => Model, shapeFn: (item: Shape | Model, lightModels?: Model[], matrix?: Matrix) => any): void; + eachShape(f: (shape: Shape) => any): void; + remove(...args: Array): void; +} + +export interface MouseEventOptions { + dragStart?: EventListener; + drag?: EventListener; + dragEnd?: EventListener; + mouseMove?: EventListener; + mouseDown?: EventListener; + mouseUp?: EventListener; + mouseWheel?: EventListener; +} + +/** + * An event dispatcher for mouse and drag events on a single dom element. The available events are 'dragStart', 'drag', 'dragEnd', 'mouseMove', 'mouseDown', 'mouseUp', 'mouseWheel' + */ +export class MouseEvents { + el: HTMLElement; + dispatch: Events.Dispatcher; + constructor(elementOrId: string | HTMLElement, options?: MouseEventOptions); + attach(): void; + detach(): void; +} + +/** + * Parser for Wavefront .obj files + * + * Note: Wavefront .obj array indicies are 1-based. + */ +export class ObjParser { + vertices: number[][]; + faces: number[][]; + commands: { v: (v: any) => any, f: (f: any) => any }; + constructor(); + mapFacePoints(faceMap: (points: Point[]) => any): void; + parse(contents: string): void; +} + +/** + * Each Painter overrides the paint method. It uses the supplied RenderLayerContext‘s builders to create and style the geometry on screen. + */ +export class Painter { + constructor(); + paint(renderModel: RenderModel, context: RenderLayerContext): void; +} + +export class PathPainter extends Painter { } + +/** + * The Point object contains x,y,z, and w coordinates. Points support various arithmetic operations with other Points, scalars, or Matrices. + * + * Most of the methods on Point are destructive, so be sure to use .copy() when you want to preserve an object’s value. + */ +export class Point { + x: number; + y: number; + z: number; + w: number; + constructor(x?: number, y?: number, z?: number, w?: number); + add(q: Point): this; + copy(): this; + cross(q: Point): this; + divide(n: number): this; + dot(q: Point): number; + magnitude(): number; + magnitudeSquared(): number; + multiply(n: number): this; + normalize(): this; + perpendicular(): this; + round(): this; + set(p: Point): this; + subtract(q: Point): this; + transform(matrix: Matrix): this; + translate(x: number, y: number, z: number): this; +} + +/** + * A Quaterionion class for computing quaterion multiplications. This creates more natural mouse rotations. + */ +export class Quaternion { + q: Point; + constructor(); + multiply(q: Point): this; + toMatrix(): Matrix; + static axisAngle(x: number, y: number, z: number, angleRads: number): Quaternion; + static pixelsPerRadian: number; + static pointAngle(p: Point, angleRads: number): Quaternion; + static xyToTransform(x: number, y: number): Matrix; +} + +export class RenderAnimator extends Animator { } + +/** + * The RenderContext uses RenderModels produced by the scene’s render method to paint the shapes into an HTML element. Since we support both SVG and Canvas painters, the RenderContext and + * RenderLayerContext define a common interface. + */ +export class RenderContext { + layers: RenderLayerContext[]; + constructor(); + animate(): RenderAnimator; + cleanup(): void; + layer(layer: RenderLayerContext): this; + render(): this; + reset(): void; + sceneLayer(scene: Scene): this; +} + +export class RenderLayer { + constructor(); + render(context: RenderLayerContext): void; +} + +/** + * The RenderLayerContext defines the interface for producing painters that can paint various things into the current layer. + */ +export class RenderLayerContext { + constructor(); + circle(): any; + cleanup(): void; + path(): any; + rect(): any; + reset(): void; + text(): any; +} + +/** + * The RenderModel object contains the transformed and projected points as well as various data needed to shade and paint a Surface. + * + * Once initialized, the object will have a constant memory footprint down to Number primitives. Also, we compare each transform and projection to prevent unnecessary re-computation. + * + * If you need to force a re-computation, mark the surface as ‘dirty’. + */ +export class RenderModel { + constructor(surface: Surface, transform: Matrix, projection: Matrix, viewport: Matrix); + update(transform: Matrix, projection: Matrix, viewport: Matrix): void; +} + +/** + * A Scene is the main object for a view of a scene. + */ +export class Scene { + constructor(options?: SceneOptions); + defaults(): SceneOptions; + flushCache(): void; + render(): Transformable[]; +} + +export interface SceneOptions { + model?: Model; + camera?: Camera; + viewport?: Viewport; + shader?: Shader; + cullBackfaces?: boolean; + fractionalPoints?: boolean; + cache?: boolean; +} + +export class SceneLayer extends RenderLayer { + model: Model; + camera: Camera; + viewport: Viewport; + shader: Shader; + cullBackfaces: boolean; + fractionalPoints: boolean; + cache: boolean; + constructor(scene: Scene); + render(context: RenderLayerContext): void; +} + +/** + * The Shader class is the base class for all shader objects. + */ +export class Shader { + constructor(); + shade(lights: Light[], renderModel: RenderModel, material: Material): void; +} + +/** + * The Phong shader implements the Phong shading model with a diffuse, specular, and ambient term. + * + * See https://en.wikipedia.org/wiki/Phong_reflection_model for more information + */ +export class Phong extends Shader { } + +/** + * The DiffusePhong shader implements the Phong shading model with a diffuse and ambient term (no specular). + */ +export class DiffusePhong extends Shader { } + +/** + * The Ambient shader colors surfaces from ambient light only. + */ +export class Ambient extends Shader { } + +/** + * The Flat shader colors surfaces with the material color, disregarding all light sources. + */ +export class Flat extends Shader { } + +/** + * A Shape contains a collection of surface. They may create a closed 3D shape, but not necessarily. For example, a cube is a closed shape, but a patch is not. + */ +export class Shape extends Transformable { + type: string; + surfaces: Surface[]; + constructor(type: string, surfaces: Surface[]); + eachSurface(f: (s: Surface) => void): this; + fill(fill: string | Color): this; + stroke(stroke: string | Color): this; +} + +export class Simplex3D { + perm: number[]; + gradP: Grad[]; + constructor(seed?: number); + noise(x: number, y: number, z: number): number; + seed(seed: number): void; +} + +/** + * A Surface is a defined as a planar object in 3D space. These paths don’t necessarily need to be convex, but they should be non-degenerate. This library does not support shapes with holes. + */ +export class Surface { + points: Point[]; + painter: Painter; + id: string; + cullBackfaces: boolean; + dirty: boolean | null; + fillMaterial: Material; + strokeMaterial: Material; + constructor(points: Point[], painter?: Painter); + fill(fill: string | Color): this; + stroke(stroke: string | Color): this; +} + +export class SvgCirclePainter extends SvgStyler { + circle(center: Point, radius: number): this; +} + +export class SvgLayerRenderContext extends RenderLayerContext { + constructor(group: SVGGElement); + circle(): SvgCirclePainter; + path(): SvgPathPainter; + rect(): SvgRectPainter; + text(): SvgTextPainter; +} + +export class SvgPathPainter extends SvgStyler { + path(points: Point[]): this; +} + +export class SvgRectPainter extends SvgStyler { + rect(width: number, height: number): this; +} + +export class SvgRenderContext extends RenderContext { + svg: SVGSVGElement; + layers: SvgLayerRenderContext[]; + constructor(svgElementOrId: string | HTMLElement); +} + +export class SvgStyler { + constructor(elementFactory: (name: string) => HTMLElement); + clear(): this; + draw(style?: Partial): this; + fill(style?: Partial): this; +} + +export class SvgTextPainter { + constructor(elementFactory: (name: string) => HTMLElement); + fillText(m: number[], text: string, style?: Partial): void; +} + +export class TextPainter extends Painter { } + +/** + * Transformable base class extended by Shape and Model. + * + * The advantages of keeping transforms in Matrix form are (1) lazy computation of point position (2) ability combine hierarchical transformations easily (3) ability to reset transformations to an + * original state. + * + * Resetting transformations is especially useful when you want to animate interpolated values. Instead of computing the difference at each animation step, you can compute the global interpolated + * value for that time step and apply that value directly to a matrix (once it is reset). + */ +export class Transformable { + baked: number[]; + m: Matrix; + constructor(); + transform(m: Matrix): this; + bake(m?: number[]): this; + matrix(m: number[]): this; + reset(): this; + rotx(theta: number): this; + roty(theta: number): this; + rotz(theta: number): this; + scale(x?: number, y?: number, z?: number): this; + translate(x?: number, y?: number, z?: number): this; +} + +/** + * A transition object to manage to animation of shapes + */ +export class Transition { + duration: number; + defaults: { duration: number }; + constructor(options?: { duration?: number }); + firstFrame(): void; + frame(): void; + lastFrame(): void; + update(t?: number): boolean; +} + +/** + * A seen.Animator for updating seen.Transtions. We include keyframing to make sure we wait for one transition to finish before starting the next one. + */ +export class TransitionAnimator extends Animator { + dispatch: Events.Dispatcher; + timestamp: number; + frameDelay: number | null; + queue: Transition[][]; + transitions: Transition[]; + add(txn: Transition): void; + keyframe(): void; + update(t?: number): void; +} + +/** + * Adds simple mouse wheel eventing to a DOM element. A ‘zoom’ event is emitted as the user is scrolls their mouse wheel. + */ +export class Zoom { + el: HTMLElement; + speed: number; + dispatch: Events.Dispatcher; + defaults: { smooth: boolean }; + constructor(elementOrId: string | HTMLElement, options?: { smooth?: boolean }); +} + +export const Painters: { + path: PathPainter, + text: TextPainter +}; +export function C(r?: number, g?: number, b?: number, a?: number): Color; +export function CanvasContext(elementOrId: string | HTMLElement, scene?: Scene): CanvasRenderContext; + +/** + * Create a render context for the element with the specified elementId. elementId should correspond to either an SVG or Canvas element. + */ +export function Context(elementOrId: string | HTMLElement, scene?: Scene): RenderContext; + +export function M(m?: number[]): Matrix; + +export function P(x?: number, y?: number, z?: number, w?: number): Point; + +export function SvgContext(elementOrId: string | HTMLElement, scene?: Scene): SvgRenderContext; + +/** + * It is not possible exactly render text in a scene with a perspective projection because Canvas and SVG support only affine transformations. So, in order to fake it, we create an affine transform + * that approximates the linear effects of a perspective projection on an unrendered planar surface that represents the text’s shape. We can use this transform directly in the text painter to warp + * the text. + * + * This fake projection will produce unrealistic results with large strings of text that are not broken into their own shapes. + */ +export const Affine: { + INITIAL_STATE_MATRIX: number[][], + ORTHONORMAL_BASIS(): Point[], + solveForAffineTransform(points: Point[]): number[] +}; + +export const BvhParser: { + SyntaxError(message: string, expected: string, found: string, location: any): void, + parse(input: string): any +}; + +export const Colors: { + CSS_RGBA_STRING_REGEX: RegExp, + black(): Color, + gray(): Color, + hex(hex: string): Color, + hsl(h: number, s: number, l: number, a?: number): Color, + parse(str: string): Color, + randomShape(shape: Shape, sat?: number, lit?: number): void, + randomSurfaces(shape: Shape, sat?: number, lit?: number): void, + randomSurfaces2(shape: Shape, drift?: number, sat?: number, lit?: number): void, + rgb(r: number, g: number, b: number, a?: number): Color, + white(): Color +}; + +export namespace Events { +/** + * The Dispatcher class. These objects have methods that can be invoked like dispatch.eventName(). Listeners can be registered with dispatch.on('eventName.uniqueId', callback). Listeners can be + * removed with dispatch.on('eventName.uniqueId', null). Listeners can also be registered and removed with dispatch.eventName.on('name', callback). + * + * Note that only one listener with the name event name and id can be registered at once. If you to generate unique ids, you can use the seen.Util.uniqueId() method. + */ + class Dispatcher { + constructor(); + on(type: string, listener: EventListener): Dispatcher; + } + +/** + * Return a new dispatcher that creates event types using the supplied string argument list. The returned Dispatcher will have methods with the names of the event types. + */ + function dispatch(): Dispatcher; + + function Event(): void; +} + +export const Lights: { + ambient(opts?: LightOptions): Light, + directional(opts?: LightOptions): Light, + point(opts?: LightOptions): Light +}; + +/** + * A few useful Matrix objects. + */ +export const Matrices: { + flipX(): Matrix, + flipY(): Matrix, + flipZ(): Matrix, + identity(): Matrix +}; + +export const Models: { + default(): Model +}; + +/** + * A few useful Point objects. Be sure that you don’t invoke destructive methods on these objects. + */ +export const Points: { + X(): Point, + Y(): Point, + Z(): Point, + ZERO(): Point +}; + +/** + * These projection methods return a 3D to 2D Matrix transformation. Each projection assumes the camera is located at (0,0,0). + */ +export const Projections: { + ortho(left?: number, right?: number, bottom?: number, top?: number, near?: number, far?: number): Matrix, + perspective(left?: number, right?: number, bottom?: number, top?: number, near?: number, far?: number): Matrix, + perspectiveFov(fovyInDegrees?: number, front?: number): Matrix +}; + +/** + * These shading functions compute the shading for a surface. To reduce code duplication, we aggregate them in a utils object. + */ +export const ShaderUtils: { + applyAmbient(c: Color, light: Light): void, + applyDiffuse(c: Color, light: Light, lightNormal: Point, surfaceNormal: Point, material?: Material): void, + applyDiffuseAndSpecular(c: Color, light: Light, lightNormal: Point, surfaceNormal: Point, material: Material): void +}; + +export const Shaders: { + ambient(): Ambient, + diffuse(): DiffusePhong, + flat(): Flat, + phong(): Phong +}; + +/** + * Shape primitives and shape-making methods + */ +export const Shapes: { + arrow(thickness?: number, tailLength?: number, tailWidth?: number, headLength?: number, headPointiness?: number): Shape, + cube(): Shape, + custom(s: Shape): Shape, + extrude(points: Point[], offset: Point): Shape, + icosahedron(): Shape, + mapPointsToSurfaces(points: Point[], coordinateMap: number[][]): Surface[], + obj(objContents: string, cullBackfaces?: boolean): Shape, + patch(nx?: number, ny?: number): Shape, + path(points: Point[]): Shape, + pipe(point1: Point, point2: Point, radius?: number, segments?: number): Shape, + pyramid(): Shape, + rectangle(point1: Point, point2: Point): Shape, + sphere(subdivisions?: number): Shape, + tetrahedron(): Shape, + text(text: string, surfaceOptions?: Partial): Shape, + unitcube(): Shape +}; + +/** + * Utility methods + */ +export const Util: { + arraysEqual(a: T[], b: T[]): boolean, + defaults(obj: T, opts: Partial, defaults: Partial): void, + element(elementOrId: string | HTMLElement): HTMLElement, + uniqueId(prefix?: string): string +}; + +export interface Viewport { + prescale: Matrix; + postscale: Matrix; +} + +export const Viewports: { + center(width?: number, height?: number, x?: number, y?: number): Viewport, + origin(width?: number, height?: number, x?: number, y?: number): Viewport +}; + +/** + * A global window event dispatcher. Attaches listeners only if window is defined. + */ +export const WindowEvents: { + on(type: string, listener: EventListener): Events.Dispatcher; +}; diff --git a/types/seen/seen-tests.ts b/types/seen/seen-tests.ts new file mode 100644 index 0000000000..05f23905ca --- /dev/null +++ b/types/seen/seen-tests.ts @@ -0,0 +1,61 @@ +/** + * Converted to TypeScript from: http://seenjs.io/demo-noisy-sphere.html + */ + +import { Shapes, Colors, Scene, Models, Viewports, Context, Simplex3D, Drag, Quaternion, RenderContext, Shape, Point, Surface, Matrix } from 'seen'; + +const width = 900; +const height = 500; + +const shape: Shape = Shapes.sphere(2).scale(150); +Colors.randomSurfaces2(shape); + +const scene: Scene = new Scene({ + fractionalPoints: true, + cullBackfaces: false, + model: Models["default"]().add(shape), + viewport: Viewports.center(width, height) +}); + +const context: RenderContext = Context('seen-canvas', scene).render(); + +const ref: Surface[] = shape.surfaces; +const originals: Point[][] = []; +let surf: Surface; +for (let j = 0, len: number = ref.length; j < len; j++) { + surf = ref[j]; + originals.push(surf.points.map(p => { + return p.copy(); + })); + surf.fillMaterial.color.a = 150; +} + +const noiser: Simplex3D = new Simplex3D(Math.random()); + +context.animate().onBefore((t, dt) => { + let n: number; + let p: Point; + let ref2: Point[]; + const ref1: Surface[] = shape.surfaces; + for (let k = 0, len1 = ref1.length; k < len1; k++) { + surf = ref1[k]; + ref2 = surf.points; + for (let i = 0, l = 0, len2 = ref2.length; l < len2; i = ++l) { + p = ref2[i]; + n = noiser.noise(p.x, p.y, p.z + t * 1e-4); + surf.points[i] = originals[k][i].copy().multiply(1 + n / 3); + } + surf.dirty = true; + } + return shape.rotx(dt * 1e-4).rotz(-dt * 1e-4); +}).start(); + +const dragger: Drag = new Drag(document.getElementById('seen-canvas')!, { + inertia: true +}); + +dragger.on('drag.rotate', (e) => { + const xform: Matrix = Quaternion.xyToTransform(e.offsetRelative[0], e.offsetRelative[1]); + shape.transform(xform); + return context.render(); +}); diff --git a/types/log-update/tsconfig.json b/types/seen/tsconfig.json similarity index 87% rename from types/log-update/tsconfig.json rename to types/seen/tsconfig.json index 888455297b..e56ea79e69 100644 --- a/types/log-update/tsconfig.json +++ b/types/seen/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, @@ -18,6 +19,6 @@ }, "files": [ "index.d.ts", - "log-update-tests.ts" + "seen-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/seen/tslint.json b/types/seen/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/seen/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/select2/v3/index.d.ts b/types/select2/v3/index.d.ts index f4a0c01efb..a74c294906 100644 --- a/types/select2/v3/index.d.ts +++ b/types/select2/v3/index.d.ts @@ -168,6 +168,14 @@ interface Select2Plugin { (method: 'search'): JQuery; (options: Select2Options): JQuery; + + /** + * Select2 exposes its default options via the $.fn.select2.defaults + * object. Properties changed in this object (same properties configurable + * through the constructor) will take effect for every instance created + * after the change. + */ + defaults: Partial; } interface JQuery { diff --git a/types/select2/v3/select2-tests.ts b/types/select2/v3/select2-tests.ts index 4a0a496e13..af2bdfd583 100644 --- a/types/select2/v3/select2-tests.ts +++ b/types/select2/v3/select2-tests.ts @@ -1,3 +1,8 @@ +$.extend($.fn.select2.defaults, { + width: 'copy', + minimumInputLength: 12 +}); + $("#e9").select2(); $("#e2").select2({ placeholder: "Select a State", diff --git a/types/sendmail/index.d.ts b/types/sendmail/index.d.ts new file mode 100644 index 0000000000..1bab6d27b6 --- /dev/null +++ b/types/sendmail/index.d.ts @@ -0,0 +1,65 @@ +// Type definitions for sendmail 1.4 +// Project: https://github.com/guileen/node-sendmail +// Definitions by: Saeid Ostad +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +declare namespace sendMailFactory { + interface Options { + logger?: { + debug?: () => void; + info?: () => void; + warn?: () => void; + error?: () => void; + }; + silent?: boolean; + /** Default: False */ + dkim?: + | boolean + | { + privateKey: string; + keySelector: string; + }; + /** Default: False */ + devPort?: number | boolean; + /** Default: localhost */ + devHost?: string; + /** Default: 25 */ + smtpPort?: number; + /** Default: -1 - extra smtp host after resolveMX */ + smtpHost?: string | number; + } + + interface MailInput { + from: string; + to: string; + cc?: string; + bcc?: string; + replyTo?: string; + returnTo?: string; + subject: string; + type?: string; + charset?: string; + encoding?: string; + id?: string; + headers?: object; + content?: string; + html?: string; + attachments?: Array<{ + type: string; + filename: string; + content: any; + }>; + } +} + +type CallbackFn = (err: Error, domain: string) => void; + +type SendMailFn = ( + mail: sendMailFactory.MailInput, + callback: CallbackFn +) => void; + +declare function sendMailFactory(options: sendMailFactory.Options): SendMailFn; + +export = sendMailFactory; diff --git a/types/sendmail/sendmail-tests.ts b/types/sendmail/sendmail-tests.ts new file mode 100644 index 0000000000..5b0f50979b --- /dev/null +++ b/types/sendmail/sendmail-tests.ts @@ -0,0 +1,24 @@ +import sendmail = require("sendmail"); + +const emailSender = sendmail({ + silent: false +}); + +const sendEmail = (options: sendmail.MailInput): Promise => + new Promise((resolve, reject) => { + emailSender(options, (err, reply) => { + // if error happened or returned code is now started with 2** + if (err || !reply.startsWith("2")) { + reject(err); + } else { + resolve(true); + } + }); + }); + +sendEmail({ + from: "Test Mail ", + to: "test@mydomain.com", + subject: "First Test", + html: "This is a Test message!" +}); diff --git a/types/sendmail/tsconfig.json b/types/sendmail/tsconfig.json new file mode 100644 index 0000000000..248bfdbfdf --- /dev/null +++ b/types/sendmail/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "sendmail-tests.ts"] +} diff --git a/types/sendmail/tslint.json b/types/sendmail/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/sendmail/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index 35b790c0f9..9aba040234 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -281,6 +281,11 @@ declare namespace sequelize { * Apply a scope on the related model, or remove its default scope by passing false. */ scope?: string | boolean; + + /** + * Load further nested related models + */ + include?: IncludeOptions; } /** @@ -1379,7 +1384,7 @@ declare namespace sequelize { * Should the join model have timestamps */ timestamps?: boolean; - + /** * Belongs-To-Many creates a unique key when primary key is not present on through model. This unique key name can be overridden using uniqueKey option. */ @@ -5938,6 +5943,15 @@ declare namespace sequelize { cls: any; useCLS(namespace:cls.Namespace): Sequelize; + /** + * Default export for `import Sequelize from 'sequelize';` kind of imports + */ + default: SequelizeStatic; + + /** + * Export sequelize static on the instance for `import Sequelize from 'sequelize';` kind of imports + */ + Sequelize: SequelizeStatic; } interface QueryOptionsTransactionRequired { } diff --git a/types/sequelize/sequelize-tests.ts b/types/sequelize/sequelize-tests.ts index 3e5fc74142..3a13906f06 100644 --- a/types/sequelize/sequelize-tests.ts +++ b/types/sequelize/sequelize-tests.ts @@ -1,6 +1,16 @@ import Sequelize = require("sequelize"); import Q = require('q'); import Bluebird = require('bluebird'); +import SequelizeAsDefault from 'sequelize'; +import { Sequelize as SequelizeAsIndividualExport } from 'sequelize'; + +// +// Import checks +// ~~~~~~~~~~~~~ +// +Sequelize.Model.Instance +SequelizeAsDefault.Model.Instance +SequelizeAsIndividualExport.Model.Instance // // Fixtures @@ -239,6 +249,13 @@ warehouse.getProducts(); warehouse.getProducts({ where: {}, scope: false }); warehouse.getProducts({ where: {}, scope: false }).then((products) => products[0].id); +interface ProductInstanceIncludeBarcode extends ProductInstance { + barcode: BarcodeInstance +} +warehouse.getProducts({ where: {}, scope: false, include: {model: Barcode, as: 'barcode'} }).then((products) => { + (products[0] as ProductInstanceIncludeBarcode).barcode +}); + warehouse.setProducts(); warehouse.setProducts([product]); warehouse.setProducts([product], { validate: true }).then(() => { }); diff --git a/types/sketchapp/index.d.ts b/types/sketchapp/index.d.ts index b45dcefe50..79a9226508 100644 --- a/types/sketchapp/index.d.ts +++ b/types/sketchapp/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for non-npm package the SketchApp 1.0 // Project: https://github.com/xlayers/xlayers // Definitions by: Wassim Chegham +// Phetsinorath William // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped type SketchMSBorderPositionEnum = 0 | 1 | 2 | 3; @@ -17,9 +18,34 @@ type SketchMSLayerListExpandedType = 0 | 1 | 2; type SketchMSEncodedBase64BinaryPlist = string; type SketchMSNSColorArchive = SketchMSKeyValueArchive; type SketchMSLayer = SketchMSPage | SketchMSSymbolMaster; +type SketchMSUserData = SketchMSUserDocument | SketchMSUserPage; interface SketchMSNestedSymbolOverride { symbolID: string; } +interface SketchMSPreview { + source: string; + width: number; + height: number; +} +interface SketchMSUserPage { + [key: string]: { + scrollOrigin: SketchMSCurvePoint; + zoomValue: number; + }; +} +interface SketchMSUserDocument { + document: { + pageListCollapsed: number; + pageListHeight: number; + }; +} +interface SketchMSData { + pages: SketchMSPage[]; + previews: SketchMSPreview[]; + document: SketchMSDocumentData; + user: SketchMSUserData; + meta: SketchMSMetadata; +} interface SketchMSStringAttribute { _class: 'stringAttribute'; attributes: { @@ -83,8 +109,8 @@ interface SketchMSImageDataReference { } type SketchMSPointString = string; interface SketchMSPath { - _class: 'path'; - isClosed: boolean; + _class: 'path' | 'shapePath' | 'rectangle' | 'oval' | 'triangle'; + isClosed?: boolean; points: SketchMSCurvePoint[]; } interface SketchMSCurvePoint { @@ -355,6 +381,8 @@ interface SketchMSSymbolMaster { attributedString: SketchMSAttributedString; name: string; layers: SketchMSLayer[]; + points: SketchMSPath; + isClosed?: boolean; isVisible: boolean; nameIsFixed: boolean; grid: SketchMSSimpleGrid; diff --git a/types/snazzy-info-window/package.json b/types/snazzy-info-window/package.json new file mode 100644 index 0000000000..77c0c562ac --- /dev/null +++ b/types/snazzy-info-window/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "handlebars": "^4.1.0" + } +} diff --git a/types/storybook__addon-a11y/index.d.ts b/types/storybook__addon-a11y/index.d.ts index 7e7ac3b89e..fa82d44867 100644 --- a/types/storybook__addon-a11y/index.d.ts +++ b/types/storybook__addon-a11y/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for @storybook/addon-a11y 3.3 +// Type definitions for @storybook/addon-a11y 5.0 // Project: https://github.com/storybooks/storybook // Definitions by: HyunSeob // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -6,4 +6,5 @@ import { StoryDecorator } from '@storybook/react'; -export const checkA11y: StoryDecorator; +export const checkA11y: StoryDecorator; // Deprecated +export const withA11y: StoryDecorator; diff --git a/types/storybook__addon-info/index.d.ts b/types/storybook__addon-info/index.d.ts index 6adc628c31..ed0f9a78d3 100644 --- a/types/storybook__addon-info/index.d.ts +++ b/types/storybook__addon-info/index.d.ts @@ -20,10 +20,10 @@ export interface Options { header?: boolean; inline?: boolean; source?: boolean; - propTables?: React.ComponentType[] | false; - propTablesExclude?: React.ComponentType[]; + propTables?: Array> | false; + propTablesExclude?: Array>; styles?: object; - components?: { [key: string]: React.ComponentType }; + components?: { [key: string]: React.ComponentType }; marksyConf?: object; maxPropsIntoLine?: number; maxPropObjectKeys?: number; diff --git a/types/storybook__addon-knobs/index.d.ts b/types/storybook__addon-knobs/index.d.ts index 3aab101f74..dbfd84a13d 100644 --- a/types/storybook__addon-knobs/index.d.ts +++ b/types/storybook__addon-knobs/index.d.ts @@ -52,6 +52,7 @@ export function object(name: string, value: T, groupId?: string): T; export function radios(name: string, options: { [s: string]: T }, value?: T, groupId?: string): string; export function select(name: string, options: { [s: string]: T }, value: T, groupId?: string): T; +export function select(name: string, options: ReadonlyArray, value: T, groupId?: string): T; export function select(name: string, options: ReadonlyArray, value: string, groupId?: string): string; export function date(name: string, value?: Date, groupId?: string): Date; diff --git a/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx b/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx index 75ab4c79a9..d09447f75d 100644 --- a/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx +++ b/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx @@ -94,7 +94,15 @@ stories.add('dynamic knobs', () => { }); const readonlyOptionsArray: ReadonlyArray = ['hi']; -select('With readonly array', readonlyOptionsArray, readonlyOptionsArray[0]); +select('With readonly string array', readonlyOptionsArray, readonlyOptionsArray[0]); + +type StringLiteralType = 'Apple' | 'Banana' | 'Grapes'; +const stringLiteralArray: StringLiteralType[] = ['Apple', 'Banana', 'Grapes']; + +let selectedFruit: StringLiteralType; + +// type of value returned from `select` must be `StringLiteralType`. +selectedFruit = select('With string literal array', stringLiteralArray, stringLiteralArray[0]); const optionsObject = { Apple: { taste: 'sweet', color: 'red' }, diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index d7d198d746..772a4bdb87 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -3359,6 +3359,15 @@ declare namespace Stripe { source?: string; } + interface IPaymentIntentRetrieveOptions { + /** + * The client secret of the PaymentIntent. Required if a publishable key is used to retrieve the source. + * + * REQUIRED IF USING PUBLISHABLE KEY! + */ + client_secret: string; + } + interface IPaymentIntentCaptureOptions { /** * The amount to capture (in cents) from the PaymentIntent, which must be less than or equal to the original amount. Any additional amount will be automatically refunded. Defaults to the full `amount_capturable` if not provided. @@ -7276,6 +7285,17 @@ declare namespace Stripe { * Client-side retrieval using a publishable key is allowed when the client_secret is provided in the query string. * When retrieved with a publishable key, only a subset of properties will be returned. Please refer to the payment intent object reference for more details. */ + retrieve( + id: string, + data: paymentIntents.IPaymentIntentRetrieveOptions, + options: HeaderOptions, + response?: IResponseFn, + ): Promise; + retrieve( + id: string, + data: paymentIntents.IPaymentIntentRetrieveOptions, + response?: IResponseFn, + ): Promise; retrieve( id: string, options: HeaderOptions, @@ -7304,6 +7324,15 @@ declare namespace Stripe { data: paymentIntents.IPaymentIntentConfirmOptions, response?: IResponseFn, ): Promise; + confirm( + paymentIntentId: string, + options: HeaderOptions, + response?: IResponseFn, + ): Promise; + confirm( + paymentIntentId: string, + response?: IResponseFn, + ): Promise; /** * Capture the funds of an existing uncaptured PaymentIntent where `required_action="requires_capture"`. @@ -7322,6 +7351,15 @@ declare namespace Stripe { data: paymentIntents.IPaymentIntentCaptureOptions, response?: IResponseFn, ): Promise; + capture( + paymentIntentId: string, + options: HeaderOptions, + response?: IResponseFn, + ): Promise; + capture( + paymentIntentId: string, + response?: IResponseFn, + ): Promise; /** * A PaymentIntent object can be canceled when it is in one of these statuses: `requires_payment_method`, `requires_capture`, `requires_confirmation`, `requires_action`. @@ -7337,6 +7375,11 @@ declare namespace Stripe { options: HeaderOptions, response?: IResponseFn, ): Promise; + cancel( + paymentIntentId: string, + options: HeaderOptions, + response?: IResponseFn, + ): Promise; cancel( paymentIntentId: string, data: { @@ -7344,6 +7387,10 @@ declare namespace Stripe { }, response?: IResponseFn, ): Promise; + cancel( + paymentIntentId: string, + response?: IResponseFn, + ): Promise; } class Payouts extends StripeResource { diff --git a/types/stripe/stripe-tests.ts b/types/stripe/stripe-tests.ts index 6fc4a5ac25..bffadadb23 100644 --- a/types/stripe/stripe-tests.ts +++ b/types/stripe/stripe-tests.ts @@ -1057,6 +1057,8 @@ stripe.paymentIntents.confirm("pi_Aabcxyz01aDfoo", {}).then((intent) => {}); stripe.paymentIntents.capture("pi_Aabcxyz01aDfoo", {}, (err, intent) => {}); stripe.paymentIntents.capture("pi_Aabcxyz01aDfoo", {}).then((intent) => {}); +stripe.paymentIntents.cancel("pi_Aabcxyz01aDfoo", (err, intent) => {}); +stripe.paymentIntents.cancel("pi_Aabcxyz01aDfoo").then((intent) => {}); stripe.paymentIntents.cancel("pi_Aabcxyz01aDfoo", {}, (err, intent) => {}); stripe.paymentIntents.cancel("pi_Aabcxyz01aDfoo", {}).then((intent) => {}); stripe.paymentIntents.cancel("pi_Aabcxyz01aDfoo", { cancellation_reason: 'duplicate' }, (err, intent) => {}); diff --git a/types/sunrise-sunset-js/index.d.ts b/types/sunrise-sunset-js/index.d.ts new file mode 100644 index 0000000000..b926ce6b50 --- /dev/null +++ b/types/sunrise-sunset-js/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for sunrise-sunset-js 2.0 +// Project: https://github.com/udivankin/sunrise-sunset +// Definitions by: Haseeb Majid +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export function getSunrise( + latitude: number, + longitude: number, + date?: Date +): Date; + +export function getSunset( + latitude: number, + longitude: number, + date?: Date +): Date; diff --git a/types/sunrise-sunset-js/sunrise-sunset-js-tests.ts b/types/sunrise-sunset-js/sunrise-sunset-js-tests.ts new file mode 100644 index 0000000000..30fc19218a --- /dev/null +++ b/types/sunrise-sunset-js/sunrise-sunset-js-tests.ts @@ -0,0 +1,4 @@ +import { getSunrise, getSunset } from "sunrise-sunset-js"; + +const sunset = getSunset(51.4541, -2.592); +const sunrise = getSunrise(51.1788, -1.8262, new Date("2000-06-21")); diff --git a/types/sunrise-sunset-js/tsconfig.json b/types/sunrise-sunset-js/tsconfig.json new file mode 100644 index 0000000000..4221b604c2 --- /dev/null +++ b/types/sunrise-sunset-js/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "sunrise-sunset-js-tests.ts"] +} diff --git a/types/sunrise-sunset-js/tslint.json b/types/sunrise-sunset-js/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/sunrise-sunset-js/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/swag/package.json b/types/swag/package.json new file mode 100644 index 0000000000..77c0c562ac --- /dev/null +++ b/types/swag/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "handlebars": "^4.1.0" + } +} diff --git a/types/tabulator-tables/index.d.ts b/types/tabulator-tables/index.d.ts new file mode 100644 index 0000000000..328cf80865 --- /dev/null +++ b/types/tabulator-tables/index.d.ts @@ -0,0 +1,1704 @@ +// Type definitions for tabulator-tables 4.2 +// Project: http://tabulator.info +// Definitions by: Josh Harris +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +// tslint:disable:max-line-length +// tslint:disable:jsdoc-format +// tslint:disable:no-trailing-whitespace + +declare namespace Tabulator { + interface Options extends OptionsGeneral, OptionsHistory, OptionsLocale, OptionsDownload, OptionsColumns, OptionsRows, OptionsData, OptionsSorting, OptionsFiltering, OptionsRowGrouping, OptionsPagination, OptionsPersistentConfiguration, OptionsClipboard, OptionsDataTree, OptionsCell {} + + interface OptionsCells extends CellCallbacks { + /** The validationFailed event is triggered when the value entered into a cell during an edit fails to pass validation. */ + validationFailed?: (cell: CellComponent, value: any, validators: Validator[] | StandardValidatorType[]) => void; + } + interface OptionsDataTree { + /** To enable data trees in your table, set the dataTree property to true in your table constructor: */ + dataTree?: boolean; + /** By default the toggle element will be inserted into the first column on the table. If you want the toggle element to be inserted in a different column you can pass the feild name of the column to the dataTreeElementColumn setup option*/ + dataTreeElementColumn?: boolean | string; + /** Show tree branch icon */ + dataTreeBranchElement?: boolean | string; + /** Tree level indent in pixels */ + dataTreeChildIndent?: number; + /** By default Tabulator will look for child rows in the _children field of a row data object. You can change this to look in a different field using the dataTreeChildField property in your table constructor: */ + dataTreeChildField?: string; + /** The toggle button that allows users to collapse and expand the column can be customised to meet your needs. There are two options, dataTreeExpandElement and dataTreeCollapseElement, that can be set to replace the default toggle elements with your own. + + Both options can take either an html string representing the contents of the toggle element */ + dataTreeCollapseElement?: string | HTMLElement | boolean; + /** The toggle button that allows users to expand the column */ + dataTreeExpandElement?: string | HTMLElement | boolean; + /** By default all nodes on the tree will start collapsed, you can customize the initial expansion state of the tree using the dataTreeStartExpanded option.* + This option can take one of three possible value types, either a boolean to indicate whether all nodes should start expanded or collapsed: */ + dataTreeStartExpanded?: boolean | boolean[] | ((row: RowComponent, level: number) => boolean); + } + interface OptionsClipboard { + /** You can enable clipboard functionality using the clipboard config option. It can take one of four possible values: + + true - enable clipboard copy and paste + "copy" - enable only copy functionality + "paste" - enable only paste functionality + false - disable all clipboard functionality (default) */ + clipboard?: boolean | "copy" | "paste"; + /** * The copy selector is a function that is used to choose which data is copied into the clipboard. Tabulator comes with a few different selectors built in: + active - Copy all table data currently displayed in the table to the clipboard (default) + table - Copy all table data to the clipboard, including data that is currently filtered out + selected - Copy the currently selected rows to the clipboard, including data that is currently filtered out + Tabulator will try to use the best selector to match your table setup. If any text is selected on the table, then it will be that text which is copied. If the table has selectable rows enabled, the it will be the currently selected rows copied to the clipboard in the order in which they were selected. Otherwise the currently visible data in the table will be copied. + + These selectors can also be used when programatically triggering a copy event. in this case if the selector is not specified it will default to the value set in the clipboardCopySelector property (which is active by default). + */ + clipboardCopySelector?: "active" | "table" | "selected"; + /** The copy formatter is used to take the row data provided by the selector and turn it into a text string for the clipboard. + There is one built in copy formatter called table, if you have extended the clipboard module and want to change the default you can use the clipboardCopyFormatter property. you can also pass in a formatting function directly into this property.*/ + clipboardCopyFormatter?: "table" | ((rowData: any[]) => string); + /** By default Tabulator will include the column header titles in any clipboard data, this can be turned off by passing a value of false to the clipboardCopyHeader property: */ + clipboardCopyHeader?: boolean; + /** Tabulator has one built in paste parser, that is designed to take a table formatted text string from the clipboard and turn it into row data. it breaks the tada into rows on a newline character \n and breaks the rows down to columns on a tab character \t. + + It will then attempt to work out which columns in the data correspond to columns in the table. It tries three different ways to achieve this. First it checks the values of all columns in the first row of data to see if they match the titles of columns in the table. If any of the columns don't match it then tries the same approach but with the column fields. If either of those options match, Tabulator will map those columns to the incoming data and import it into rows. If there is no match then Tabulator will assume the columns in the data are in the same order as the visible columns in the table and import them that way. + + The inbuilt parser will reject any clipboard data that does not contain at least one row and two columns, in that case the clipboardPasteError will be triggered. + + If you extend the clipboard module to add your own parser, you can set it to be used as default with the clipboardPasteParser property.*/ + clipboardPasteParser?: string | ((clipboard: any) => any[]); + /** Once the data has been parsed into row data, it will be passed to a paste action to be added to the table. There are three inbuilt paste actions: + + insert - Inserts data into the table using the addRows function (default) + update - Updates data in the table using the updateOrAddData function + replace - replaces all data in the table using the setData function */ + clipboardPasteAction?: "insert" | "update" | "replace"; + + /** By default Tabulator will copy some of the tables styling along with the data to give a better visual appearance when pasted into other documents. + + If you want to only copy the unstyled data then you should set the clipboardCopyStyled option to false in the table options object: */ + clipboardCopyStyled?: boolean; + + /** By default Tabulator includes column headers, row groups and column calculations in the clipboard output. + + You can choose to remove column headers groups, row groups or column calculations from the output data by setting the values in the clipboardCopyConfig option in the table definition: */ + clipboardCopyConfig?: + | { + columnHeaders?: boolean; + rowGroups?: boolean; + columnCalcs?: boolean; + } + | boolean; + + /** The clipboardCopied event is triggered whenever data is copied to the clipboard. */ + clipboardCopied: () => void; + /** The clipboardPasted event is triggered whenever data is successfuly pasted into the table. */ + clipboardPasted: () => void; + /** The clipboardPasteError event is triggered whenever an atempt to paste data into the table has failed because it was rejected by the paste parser. */ + clipboardPasteError: () => void; + } + + interface OptionsPersistentConfiguration { + /** ID tag used to identify persistent storage information */ + persistenceID?: string; + /** Persistence information can either be stored in a cookie or in the localSotrage object, you can use the persistenceMode to choose which. It can take three possible values: + + local - (string) Store the persistence information in the localStorage object + cookie - (string) Store the persistence information in a cookie + true - (boolean) check if localStorage is available and store persistence information, otherwise store in cookie (Default option) */ + persistenceMode?: "local" | "cookie" | true; + /** Enable persistsnt storage of column layout information */ + persistentLayout?: boolean; + /** You can ensure the data sorting is stored for the next page load by setting the persistentSort option to true */ + persistentSort?: boolean; + /** You can ensure the data filtering is stored for the next page load by setting the persistentFilter option to true*/ + persistentFilter?: boolean; + } + + interface OptionsPagination { + /** Choose pagination method, "local" or "remote" */ + pagination?: "remote" | "local"; + /** Set the number of rows in each page */ + paginationSize?: number; + /** Setting this option to true will cause Tabulator to create a list of page size options, that are multiples of the current page size. In the example below, the list will have the values of 5, 10, 15 and 20. + + When using the page size selector like this, if you use the setPageSize function to set the page size to a value not in the list, the list will be regenerated using the new page size as the starting valuer */ + paginationSizeSelector?: true | number[]; + /** By default the pagination controls are added to the footer of the table. If you wish the controls to be created in another element pass a DOM node or a CSS selector for that element to the paginationElement option.*/ + paginationElement?: HTMLElement | "string"; + /** Lookup list to link expected data feilds from the server to their function * default* { + "current_page":"current_page", + "last_page":"last_page", + "data":"data", + }* * + */ + paginationDataReceived?: Record; + /** Lookup list to link fields expected by the server to their function* default:* { + "page":"page", + "size":"size", + "sorters":"sorters", + "filters":"filters", + } + */ + paginationDataSent?: Record; + /** When using the addRow function on a paginated table, rows will be added relative to the current page (ie to the top or bottom of the current page), with overflowing rows being shifted onto the next page. + + If you would prefer rows to be added relative to the table (firs/last page) then you can use the paginationAddRow option. it can take one of two values: + + page - add rows relative to current page (default) + table - add rows relative to the table */ + paginationAddRow?: "table" | "page"; + /** The number of pagination page buttons shown in the footer using the paginationButtonCount option. By default this has a value of 5.*/ + paginationButtonCount?: number; + } + + interface OptionsRowGrouping { + /** String/function to select field to group rows by */ + groupBy?: string | ((data: any) => any); + /** By default Tabulator will create groups for rows based on the values contained in the row data. if you want to explicitly define which field values groups should be created for at each level, you can use the groupValues option. + + This option takes an array of value arrays, each item in the first array should be a list of acceptable field values for groups at that level */ + groupValues?: any[][]; + + /** You can use the setGroupHeader function to change the header generation function for each group. This function has one argument and takes the same values as passed to the groupHeader setup option. */ + groupHeader?: ((value: any, count: number, data: any, group: GroupComponent) => string) | Array<(value: any, count: number, data: any) => string>; + + /** You can set the default open state of groups using the groupStartOpen property* * This can take one of three possible values: + + true - all groups start open (default value) + false - all groups start closed + function() - a callback to decide if a group should start open or closed + Group Open Function + If you want to decide on a group by group basis which should start open or closed then you can pass a function to the groupStartOpen property. This should return true if the group should start open or false if the group should start closed. + */ + groupStartOpen?: boolean | ((value: any, count: number, data: any, group: GroupComponent) => boolean); + + /** By default Tabulator allows users to toggle a group open or closed by clicking on the arrow icon in the left of the group header. If you would prefer a different behaviour you can use the groupToggleElement option to choose a different option:* * The option can take one of three values: + arrow - togggle group on arrow element click + header - toggle group on click anywhere on the group header element + false - prevent clicking anywhere in the group toggling the group + */ + groupToggleElement?: "arrow" | "header" | false; + + /** show/hide column calculations when group is closed */ + groupClosedShowCalcs?: boolean; + + /** The dataGrouping callback is triggered whenever a data grouping event occurs, before grouping happens. */ + dataGrouping?: () => void; + /** The dataGrouping callback is triggered whenever a data grouping event occurs, after grouping happens. */ + dataGrouped?: () => void; + /** The groupVisibilityChanged callback is triggered whenever a group changes between hidden and visible states. */ + groupVisibilityChanged?: (group: GroupComponent, visible: boolean) => void; + + /** The groupClick callback is triggered when a user clicks on a group header. */ + groupClick?: GroupEventCallback; + /** The groupDblClick callback is triggered when a user double clicks on a group header. */ + groupDblClick?: GroupEventCallback; + /** The groupContext callback is triggered when a user right clicks on a group header. + + If you want to prevent the browsers context menu being triggered in this event you will need to include the preventDefault() function in your callback. */ + groupContext?: GroupEventCallback; + /** The groupTap callback is triggered when a user taps on a group header on a touch display. */ + groupTap?: GroupEventCallback; + /** The groupDblTap callback is triggered when a user taps on a group header on a touch display twice in under 300ms. */ + groupDblTap?: GroupEventCallback; + /** The groupTapHold callback is triggered when a user taps on a group header on a touch display and holds their finger down for over 1 second */ + groupTapHold?: GroupEventCallback; + } + + interface Filter { + field: string; + type: FilterType; + value: any; + } + + type FilterFunction = (field: string, type: FilterType, value: any) => void; + + interface OptionsFiltering { + /** Array of filters to be applied on load. */ + initialFilter?: Filter[]; + + /** array of initial values for header filters. */ + initialHeaderFilter?: Array>; + + /** The dataFiltering callback is triggered whenever a filter event occurs, before the filter happens. */ + dataFiltering?: (filters: Filter[]) => void; + /** The dataFiltered callback is triggered after the table dataset is filtered. */ + dataFiltered?: (filters: Filter[], rows: RowComponent[]) => void; + } + interface OptionsSorting { + /** Array of sorters to be applied on load. */ + initialSort?: Sorter[]; + + /** reverse the order that multiple sorters are applied to the table. */ + sortOrderReverse?: boolean; + } + + interface Sorter { + column: string; + dir: SortDirection; + } + interface OptionsData { + /** A unique index value should be present for each row of data if you want to be able to programatically alter that data at a later point, this should be either numeric or a string. By default Tabulator will look for this value in the id field for the data. If you wish to use a different field as the index, set this using the index option parameter. */ + index?: number | string; + /** Array to hold data that should be loaded on table creation */ + data?: any[]; + + /** If you wish to retrieve your data from a remote source you can set the URL for the request in the ajaxURL option. */ + ajaxURL?: string; + + /** Parameters to be passed to remote Ajax data loading request */ + ajaxParams?: {}; + + /** The HTTP request type for Ajax requests or config object for the request */ + ajaxConfig?: HttpMethod | AjaxConfig; + + /** When using a request method other than "GET" Tabulator will send any parameters with a content type of form data. You can change the content type with the ajaxContentType option. This will ensure parameters are sent in the format you expect, with the correct headers. * * The ajaxContentType option can take one of two values: + "form" - send parameters as form data (default option) + "json" - send parameters as JSON encoded string + If you want to use a custom content type then you can pass a content type formatter object into the ajaxContentType option. this object must have two properties, the headers property should contain all headers that should be sent with the request and the body property should contain a function that returns the body content of the request + */ + + ajaxContentType?: "form" | "json" | AjaxContentType; + + /** If you need more control over the url of the request that you can get from the ajaxURL and ajaxParams properties, the you can use the ajaxURLGenerator property to pass in a callback that will generate the URL for you. + + The callback should return a string representing the URL to be requested. */ + ajaxURLGenerator?: (url: string, config: any, params: any) => string; + + /** callback function to replace inbuilt ajax request functionality */ + ajaxRequestFunc?: (url: string, config: any, params: any) => Promise; + + /** Send filter config to server instead of processing locally */ + ajaxFiltering?: boolean; + + /** Send sorter config to server instead of processing locally */ + ajaxSorting?: boolean; + + /** If you are loading a lot of data from a remote source into your table in one go, it can sometimes take a long time for the server to return the request, which can slow down the user experience. + + To speed things up in this situation Tabulator has a progressive load mode, this uses the pagination module to make a series of requests for part of the data set, one at a time, appending it to the table as the data arrives. This mode can be enable using the ajaxProgressiveLoad option. No pagination controls will be visible on screen, it just reusues the functionality of the pagination module to sequentially load the data. + + With this mode enabled, all of the settings outlined in the Ajax Documentation are still available + + There are two different progressive loading modes, to give you a choice of how data is loaded into the table. */ + ajaxProgressiveLoad?: "load" | "scroll"; + /** By default tabulator will make the requests to fill the table as quickly as possible. On some servers these repeates requests from the same client may trigger rate limiting or security systems. In this case you can use the ajaxProgressiveLoadDelay option to add a delay in milliseconds between each page request. */ + ajaxProgressiveLoadDelay?: number; + /** The ajaxProgressiveLoadScrollMargin property determines how close to the bottom of the table in pixels, the scroll bar must be before the next page worth of data is loaded, by default it is set to twice the height of the table. */ + ajaxProgressiveLoadScrollMargin?: number; + + /** Show loader while data is loading, can also take a function that must return a boolean */ + ajaxLoader?: boolean | (() => boolean); + + /** html for loader element */ + ajaxLoaderLoading?: string; + /** html for the loader element in the event of an error */ + ajaxLoaderError?: string; + + /** The ajaxRequesting callback is triggered when ever an ajax request is made. */ + ajaxRequesting?: (url: string, params: any) => boolean; + /** The ajaxResponse callback is triggered when a successful ajax request has been made. This callback can also be used to modify the received data before it is parsed by the table. If you use this callback it must return the data to be parsed by Tabulator, otherwise no data will be rendered */ + ajaxResponse?: (url: string, params: any, response: any) => any; + /** The ajaxError callback is triggered there is an error response to an ajax request. */ + ajaxError?: (xhr: any, textStatus: any, errorThrown: any) => void; + } + + interface AjaxContentType { + headers: JSONRecord; + body: (url: string, config: any, params: any) => any; + } + + type HttpMethod = "GET" | "POST"; + interface AjaxConfig { + method?: HttpMethod; + headers?: JSONRecord; + mode?: string; + credentials?: string; + } + + interface OptionsRows { + /** Tabulator also allows you to define a row level formatter using the rowFormatter option. this lets you alter each row of the table based on the data it contains. + + The function accepts one argument, the RowComponent for the row being formatted. */ + rowFormatter?: (row: RowComponent) => any; + + /** The position in the table for new rows to be added, "bottom" or "top" */ + addRowPos?: "bottom" | "top"; + + /** The selectable option can take one of a several values: + + false - selectable rows are disabled + true - selectable rows are enabled, and you can select as many as you want + integer - any integer value, this sets the maximum number of rows that can be selected (when the maximum number of selected rows is exeded, the first selected row will be deselected to allow the next row to be selected). + "highlight" (default) - rows have the same hover stylings as selectable rows but do not change state when clicked. This is great for when you want to show that a row is clickable but don't want it to be selectable. */ + selectable?: boolean | number | "highlight"; + + /** By default you can select a range of rows by holding down the shift key and click dragging over a number of rows to toggle the selected state state of all rows the cursor passes over. + + If you would prefere to select a range of row by clicking on the first row then holding down shift and clicking on the end row then you can acheive this by setting the selectableRangeMode to click */ + selectableRangeMode?: "click"; + + /** By default, row selection works on a rolling basis, if you set the selectable option to a numeric value then when you select past this number of rows, the first row to be selected will be deselected. If you want to disable this behaviour and instead prevent selection of new rows once the limit is reached you can set the selectableRollingSelection option to false. */ + selectableRollingSelection?: boolean; + + /** By default Tabulator will maintain selected rows when the table is filtered, sorted or paginated (but NOT when the setData function is used). If you want the selected rows to be cleared whenever the table view is updated then set the selectablePersistence option to false. */ + selectablePersistence?: boolean; + + /** You many want to exclude certain rows from being selected. The selectableCheck options allows you to pass a function to check if the current row should be selectable, returning true will allow row selection, false will result in nothing happening. The function should accept a RowComponent as its first argument. */ + selectableCheck?: (row: RowComponent) => boolean; + + /** To allow the user to move rows up and down the table, set the movableRows parameter in the options: */ + movableRows?: boolean; + + /** Tabulator also allows you to move rows between tables. To enable this you should supply either a valid CSS selector string a DOM node for the table or the Tabuator object for the table to the movableRowsConnectedTables option. if you want to connect to multple tables then you can pass in an array of values to this option. */ + movableRowsConnectedTables?: string | string[] | HTMLElement | HTMLElement[]; + + /** The movableRowsSender option should be set on the sending table, and sets the action that should be taken after the row has been successfuly dropped into the receiving table. + + There are several inbuilt sender functions: + + false - do nothing(default) + delete - deletes the row from the table + You can also pass a callback to the movableRowsSender option for custom sender functionality + */ + movableRowsSender?: false | "delete" | ((fromRow: RowComponent, toRow: RowComponent, toTable: Tabulator) => any); + + /** The movableRowsReceiver option should be set on the receiving tables, and sets the action that should be taken when the row is dropped into the table. + There are several inbuilt receiver functions: + + insert - inserts row next to the row it was dropped on, if not dropped on a row it is added to the table (default) + add - adds row to the table + update - updates the row it is dropped on with the sent rows data + replace - replaces the row it is dropped on with the sent row*/ + movableRowsReceiver?: "insert" | "add" | "update" | "replace" | ((fromRow: RowComponent, toRow: RowComponent, fromTable: Tabulator) => any); + + /** You can allow the user to manually resize rows by dragging the top or bottom border of a row. To enable this functionality, set the resizableRows property to true */ + resizableRows?: boolean; + + /** * The default ScrollTo position can be set using the scrollToRowPosition option. It can take one of four possible values: + + top - position row with its top edge at the top of the table (default) + center - position row with its top edge in the center of the table + bottom - position row with its bottom edge at the bottom of the table + nearest - position row on the edge of the table it is closest to + */ + scrollToRowPosition?: ScrollToRowPostition; + + /** The default option for triggering a ScrollTo on a visible element can be set using the scrollToRowIfVisible option. It can take a boolean value: + + true - scroll to row, even if it is visible (default) + false - scroll to row, unless it is currently visible, then don't move */ + scrollToRowIfVisible?: boolean; + + /** The dataTreeRowExpanded callback is triggered when a row with child rows is expanded to reveal the children. */ + dataTreeRowExpanded?: (row: RowComponent, level: number) => void; + + /** The dataTreeRowCollapsed callback is triggered when a row with child rows is collapsed to hide its children.*/ + dataTreeRowCollapsed?: (row: RowComponent, level: number) => void; + + /** The movableRowsSendingStart callback is triggered on the sending table when a row is picked up from a sending table. */ + movableRowsSendingStart?: (toTables: any[]) => void; + + /** The movableRowsSent callback is triggered on the sending table when a row has been successfuly received by a receiving table. */ + movableRowsSent?: (fromRow: RowComponent, toRow: RowComponent, toTable: Tabulator) => void; + + /** The movableRowsSentFailed callback is triggered on the sending table when a row has failed to be received by the receiving table.*/ + movableRowsSentFailed?: (fromRow: RowComponent, toRow: RowComponent, toTable: Tabulator) => void; + + /** The movableRowsSendingStop callback is triggered on the sending table after a row has been dropped and any senders and receivers have been handled. */ + movableRowsSendingStop?: (toTables: any[]) => void; + + /** The movableRowsReceivingStart callback is triggered on a receiving table when a connection is established with a sending table. */ + movableRowsReceivingStart?: (fromRow: RowComponent, toTable: Tabulator) => void; + + /** The movableRowsReceived callback is triggered on a receiving table when a row has been successfuly received.*/ + movableRowsReceived?: (fromRow: RowComponent, toRow: RowComponent, fromTable: Tabulator) => void; + + /** The movableRowsReceivedFailed callback is triggered on a receiving table when a row receiver has returned false.*/ + movableRowsReceivedFailed?: (fromRow: RowComponent, toRow: RowComponent, fromTable: Tabulator) => void; + + /** The movableRowsReceivingStop callback is triggered on a receiving table after a row has been dropped and any senders and receivers have been handled.*/ + movableRowsReceivingStop?: (fromTable: Tabulator) => void; + + /** The rowClick callback is triggered when a user clicks on a row. */ + rowClick?: RowEventCallback; + /** The rowDblClick callback is triggered when a user double clicks on a row. */ + rowDblClick?: RowEventCallback; + /** The rowContext callback is triggered when a user right clicks on a row. + + If you want to prevent the browsers context menu being triggered in this event you will need to include the preventDefault() function in your callback. */ + rowContext?: RowEventCallback; + /** The rowTap callback is triggered when a user taps on a row on a touch display. */ + rowTap?: RowEventCallback; + /** The rowDblTap callback is triggered when a user taps on a row on a touch display twice in under 300ms. */ + rowDblTap?: RowEventCallback; + /** The rowTapHold callback is triggered when a user taps on a row on a touch display and holds their finger down for over 1 second. */ + rowTapHold?: RowEventCallback; + /** The rowMouseEnter callback is triggered when the mouse pointer enters a row. */ + rowMouseEnter?: RowEventCallback; + /** The rowMouseLeave callback is triggered when the mouse pointer leaves a row. */ + rowMouseLeave?: RowEventCallback; + /** The rowMouseOver callback is triggered when the mouse pointer enters a row or any of its child elements.*/ + rowMouseOver?: RowEventCallback; + /** The rowMouseOut callback is triggered when the mouse pointer leaves a row or any of its child elements. */ + rowMouseOut?: RowEventCallback; + /** The rowMouseMove callback is triggered when the mouse pointer moves over a row. */ + rowMouseMove?: RowEventCallback; + /** The rowAdded callback is triggered when a row is added to the table by the addRow and updateOrAddRow functions. */ + rowAdded?: RowChangedCallback; + /** The rowUpdated callback is triggered when a row is updated by the updateRow, updateOrAddRow, updateData or updateOrAddData, functions. */ + rowUpdated?: RowChangedCallback; + /** The rowDeleted callback is triggered when a row is deleted from the table by the deleteRow function. */ + rowDeleted?: RowChangedCallback; + /** The rowMoved callback will be triggered when a row has been successfuly moved. */ + rowMoved?: RowChangedCallback; + /** The rowResized callback will be triggered when a row has been resized by the user. */ + rowResized?: RowChangedCallback; + /** Whenever the number of selected rows changes, through selection or deselection, the rowSelectionChanged event is triggered. This passes an array of the data objects for each row in the order they were selected as the first argument, and an array of row components for each of the rows in order of selection as the second argument. */ + rowSelectionChanged?: (data: any[], rows: RowComponent[]) => void; + /** The rowSelected event is triggered when a row is selected, either by the user or programatically. */ + rowSelected?: RowChangedCallback; + /** The rowDeselected event is triggered when a row is deselected, either by the user or programatically. */ + rowDeselected?: RowChangedCallback; + } + + interface OptionsColumns { + /** The column definitions are provided to Tabluator in the columns property of the table constructor object and should take the format of an array of objects, with each object representing the configuration of one column. */ + columns?: ColumnDefinition[]; + + /** + * If you set the autoColumns option to true, every time data is loaded into the table through the data option or through the setData function, Tabulator will examine the first row of the data and build columns to match that data. + */ + autoColumns?: boolean; + + /** By default Tabulator will use the fitData layout mode, which will resize the tables columns to fit the data held in each column, unless you specify a width or minWidth in the column constructor. If the width of all columns exceeds the width of the containing element, a scroll bar will appear. */ + layout?: "fitData" | "fitColumns" | "fitDataFill"; + + /** To keep the layout of the columns consistent, once the column widths have been set on the first data load (either from the data property in the constructor or the setData function) they will not be changed when new data is loaded. + + If you would prefer that the column widths adjust to the data each time you load it into the table you can set the layoutColumnsOnNewData property to true. */ + layoutColumnsOnNewData?: boolean; + + /** Responsive layout will automatically hide/show columns to fit the width of the Tabulator element. This allows for clean rendering of tables on smaller mobile devices, showing important data while avoiding horizontal scroll bars. You can enable responsive layouts using the responsiveLayout option. + + There are two responsive layout modes available: + + hide - hide columns that no longer fit in the table + collapse - collapse columns that no longer fit on the table into a list under the row + + Hide Extra Columns + By default, columns will be hidden from right to left as the width of the table decreases. You can choose exactlyhow columns are hidden using the responsive property in the column definition object. + + When responsive layout is enabled, all columns are given a default responsive value of 1. The higher you set this value the sooner that column will be hidden as the table width decreases. If two columns have the same responsive value then they are hidden from right to left (as defined in the column definition array, ignoring user moving of the columns). If you set the value to 0 then the column will never be hidden regardless of how narrow the table gets. */ + responsiveLayout?: boolean | "hide" | "collapse"; + + /** Collapsed lists are displayed to the user by default, if you would prefer they start closed so the user can open them you can use the responsiveLayoutCollapseStartOpen option */ + responsiveLayoutCollapseStartOpen?: boolean; + + /** By default any formatter set on the column is applied to the value that will appear in the list. while this works for most formatters it can cause issues with the progress formatter which relies on being inside a cell. + + If you would like to disable column formatting in the collapsed list, you can use the responsiveLayoutCollapseUseFormatters option: */ + responsiveLayoutCollapseUseFormatters?: boolean; + + /** If you set the responsiveLayout option to collapse the values from hidden columns will be displayed in a title/value list under the row. + + In this mode an object containing the title of each hidden column and its value is generated and then used to generate a list displayed in a div .tabulator-responsive-collapse under the row data. + + The inbuilt collapse formatter creates a table to neatly display the hidden columns. If you would like to format the data in your own way you can use the responsiveLayoutCollapseFormatter, it take an object of the column values as an argument and must return the HTML content of the div. + + This function should return an empty string if there is no data to display. */ + responsiveLayoutCollapseFormatter?: (data: any[]) => any; + + /** It is possible to set a minimum column width to prevent resizing columns from becoming too small. + + This can be set globally, by setting the columnMinWidth option to the column width when you create your Tabulator. + + This option can be overridden on a per column basis by setting the minWidth property on the column definition. */ + columnMinWidth?: number; + + /** By default it is possible to manually resize columns by dragging the borders of the column in both the column headers and the cells of the column. + + If you want to alter this behaviour you can use the resizableColumns to choose where the resize handles are available. */ + resizableColumns?: true | false | "header" | "cell"; + + /** To allow the user to move columns along the table, set the movableColumns parameter in the options: */ + movableColumns?: boolean; + + /** Header tooltips can be set globally using the tooltipsHeader options parameter */ + tooltipsHeader?: boolean; + + /** You can use the columnVertAlign option to set how the text in your column headers should be vertically */ + columnVertAlign?: "top" | "middle" | "bottom"; + + /** The default placeholder text used for input elements can be set using the headerFilterPlaceholder option in the table definition */ + headerFilterPlaceholder?: string; + + /** The default ScrollTo position can be set using the scrollToColumnPosition option. It can take one of three possible values: + + left - position column with its left edge at the left of the table (default) + center - position column with its left edge in the center of the table + right - position column with its right edge at the right of the table */ + scrollToColumnPosition?: ScrollToColumnPosition; + + /** The default option for triggering a ScrollTo on a visible element can be set using the scrollToColumnIfVisible option. It can take a boolean value: + + true - scroll to column, even if it is visible (default) + false - scroll to column, unless it is currently visible, then don't move */ + scrollToColumnIfVisible?: boolean; + + /** By default column calculations are shown at the top and bottom of the table, unless row grouping is enabled, in which case they are shown at the top and bottom of each group. + + The columnCalcs option lets you decided where the calculations should be displayed, it can take one of four values: + + true - show calcs at top and bottom of the table, unless grouped, then show in groups (boolean, default) + both - show calcs at top and bottom of the table and show in groups + table - show calcs at top and bottom of the table only + group - show calcs in groups only */ + columnCalcs?: boolean | "both" | "table" | "group"; + + /** If you need to use the . character as part of your field name, you can change the separator to any other character using the nestedFieldSeparator option + * Set to false to disable nested data parsing + */ + nestedFieldSeparator?: string | boolean; + + /** multiple or single column sorting */ + columnHeaderSortMulti?: boolean; + + /** The columnMoved callback will be triggered when a column has been successfuly moved. */ + columnMoved?: (column: ColumnComponent, columns: any[]) => void; + columnResized?: (column: ColumnComponent) => void; + /** The columnVisibilityChanged callback is triggered whenever a column changes between hidden and visible states. */ + columnVisibilityChanged?: (column: ColumnComponent, visible: boolean) => void; + + /** The columnTitleChanged callback is triggered whenever a user edits a column title when the editableTitle parameter has been enabled in the column definition array. */ + columnTitleChanged?: (column: ColumnComponent) => void; + } + + interface OptionsCell { + /** The cellClick callback is triggered when a user left clicks on a cell, it can be set on a per column basis using the option in the columns definition object. */ + cellClick?: CellEventCallback; + cellDblClick?: CellEventCallback; + cellContext?: CellEventCallback; + cellTap?: CellEventCallback; + cellDblTap?: CellEventCallback; + cellTapHold?: CellEventCallback; + cellMouseEnter?: CellEventCallback; + cellMouseLeave?: CellEventCallback; + cellMouseOver?: CellEventCallback; + cellMouseOut?: CellEventCallback; + cellMouseMove?: CellEventCallback; + cellEditing?: CellEditEventCallback; + cellEdited?: CellEditEventCallback; + cellEditCancelled?: CellEditEventCallback; + } + + interface OptionsGeneral { + /** Sets the height of the containing element, can be set to any valid height css value. If set to false (the default), the height of the table will resize to fit the table data. */ + height?: string | number | false; + /** Enable rendering using the Virtual DOM engine */ + virtualDom?: boolean; + + /** Manually set the size of the virtual DOM buffer */ + virtualDomBuffer?: boolean; + /** placeholder element to display on empty table */ + placeholder?: string | HTMLElement; + + /** Footer element to display for the table */ + footerElement?: string | HTMLElement; + + /** Function to generate tooltips for cells */ + tooltips?: GlobalTooltipOption; + /** When to regenerate cell tooltip value */ + tooltipGenerationMode?: "load"; + + /** Keybinding configuration object */ + keybindings?: false | KeyBinding; + + /** * The reactivity systems allow Tabulator to watch arrays and objects passed into the table for changes and then automatically update the table. + + This approach means you no longer need to worry about calling a number of different functions on the table to make changes, you simply update the array or object you originally passed into the table and Tabulator will take care of the rest. + + You can enable reactive data by setting the reactiveData option to true in the table constructor, and then passing your data array to the data option. + + Once the table is built any changes to the array will automatically be replicated to the table without needing to call any functions on the table itself*/ + + reactiveData?: boolean; + + // Not listed in options-------------------- + /** Tabulator will automatically attempt to redraw the data contained in the table if the containing element for the table is resized. To disable this functionality, set the autoResize property to false */ + autoResize?: boolean; + + /** When a the tabulator constructor is called, the tableBuilding callback will triggered */ + tableBuilding?: () => void; + + /** When a the tabulator constructor is called and the table has finished being rendered, the tableBuilt callback will triggered: */ + tableBuilt?: () => void; + + /** The renderStarted callback is triggered whenever all the rows in the table are about to be rendered. This can include: + Data is loaded into the table when setData is called + A page is loaded through any form of pagination + Rows are added to the table during progressive rendering + Columns are changed by setColumns + The data is filtered + The data is sorted + The redraw function is called */ + renderStarted?: () => void; + + /** The renderComplete callback is triggered after the table has been rendered */ + renderComplete?: () => void; + + /** The htmlImporting callback is triggered when Tabulator starts importing data from an HTML table. */ + htmlImporting?: EmptyCallback; + + /** The htmlImported callback is triggered when Tabulator finishes importing data from an HTML table. */ + htmlImported?: EmptyCallback; + + /** The dataLoading callback is triggered whenever new data is loaded into the table. */ + dataLoading?: (data: any) => void; + /** The dataLoaded callback is triggered when a new set of data is loaded into the table. */ + dataLoaded?: (data: any) => void; + /** The dataEdited callback is triggered whenever the table data is changed by the user. Triggers for this include editing any cell in the table, adding a row and deleting a row. */ + dataEdited?: (data: any) => void; + + /** Whenever a page has been loaded, the pageLoaded callback is called, passing the current page number as an argument. */ + pageLoaded?: (pageno: number) => void; + + /** The dataSorting callback is triggered whenever a sort event occurs, before sorting happens. */ + dataSorting?: (sorters: Sorter[]) => void; + + /** The dataSorted callback is triggered after the table dataset is sorted. */ + dataSorted?: (sorters: Sorter[], rows: RowComponent[]) => void; + } + + type DownloadType = "csv" | "json" | "xlsx" | "pdf"; + + interface DownloadOptions extends DownloadCSV, DownloadXLXS, DownloadPDF { + downloadType: DownloadType; + fileName: string; + } + + interface DownloadCSV { + /** By default CSV files are created using a comma (,) delimiter. If you need to change this for any reason the you can pass the options object with a delimiter property to the download function which will then use this delimiter instead of the comma. */ + delimiter?: "string"; + /** If you need the output CSV to include a byte order mark (BOM) to ensure that output with UTF-8 characters can be correctly interpereted across didfferent applications, you should set the bom option to true */ + bom?: boolean; + } + + interface DownloadXLXS { + /** The sheet name must be a valid Excel sheet name, and cannot include any of the following characters \, /, *, [, ], :, */ + sheetName?: string; + } + + interface DownloadPDF { + orientation?: "portrait" | "landscape"; + title?: string; + rowGroupStyles?: any; + rowCalcStyles?: any; + jsPDF?: any; + autoTable?: {} | ((doc: any) => any); + } + + interface OptionsDownload { + /** If you want to make any bulk changes to the table data before it is parsed into the download file you can pass a mutator function to the downloadDataFormatter option in the table definition */ + downloadDataFormatter?: (data: any[]) => any; + + /** The downloadReady callback allows you to intercept the download file data before the users is prompted to save the file. + + In order for the download to proceed the downloadReady callback is expected to return a blob of file to be downloaded. + + If you would prefer to abort the download you can return false from this callback. This could be useful for example if you want to send the created file to a server via ajax rather than allowing the user to download the file. */ + downloadReady?: (fileContents: any, blob: any) => any; + + /** The downloadComplete callback is triggered when the user has been prompted to download the file. */ + downloadComplete?: () => void; + + /** By default Tabulator includes column headers, row groups and column calculations in the download output. + + You can choose to remove column headers groups, row groups or column calculations from the output data by setting the values in the downloadConfig option in the table definition: */ + + downloadConfig?: { + columnGroups?: boolean; + rowGroups?: boolean; + columnCalcs?: boolean; + }; + } + + interface OptionsLocale { + /** You can set the current local in one of two ways. If you want to set it when the table is created, simply include the locale option in your Tabulator constructor. You can either pass in a string matching one of the language options you have defined, or pass in the boolean true which will cause Tabulator to auto-detect the browsers language settings from the navigator.language object. */ + locale?: boolean | string; + + /** You can store as many languages as you like, creating an object inside the langs object with a property of the locale code for that language. A list of locale codes can be found here. + + At present there are three parts of the table that can be localised, the column headers, the header filter placeholder text and the pagination buttons. To localize the pagination buttons, create a pagination property inside your language object and give it the properties outlined below. + + If you wish you can also localize column titles by adding a columns property to your language object. You should store a property of the field name of the column you wish to change, with a value of its title. Any fields that match this will use this title instead of the one provided by the column definition array. */ + langs?: any; + + /** When a localization event has occurred , the localized callback will triggered, passing the current locale code and language object: */ + localized?: (locale: string, lang: any) => void; + } + + type HistoryAction = "cellEdit" | "rowAdd" | "rowDelete" | "rowMoved"; + interface OptionsHistory { + /** Enable user interaction history functionality */ + history?: boolean; + + /** The historyUndo event is triggered when the undo action is triggered. */ + historyUndo: (action: HistoryAction, component: CellComponent | RowComponent, data: any) => void; + /** The historyRedo event is triggered when the redo action is triggered. */ + historyRedo: (action: HistoryAction, component: CellComponent | RowComponent, data: any) => void; + } + + interface ColumnLayout { + /** title - Required This is the title that will be displayed in the header for this column */ + title: string; + /** field - Required (not required in icon/button columns) this is the key for this column in the data array*/ + field?: string; + /** visible - (boolean, default - true) determines if the column is visible. (see Column Visibility for more details */ + visible?: boolean; + + /** sets the width of this column, this can be set in pixels or as a percentage of total table width (if not set the system will determine the best) */ + width?: number | string; + } + + interface ColumnDefinition extends ColumnLayout, CellCallbacks { + // Layout + /** sets the text alignment for this column */ + align?: "left" | "center" | "right"; // Align? + /** sets the minimum width of this column, this should be set in pixels (this takes priority over the global option of columnMinWidth) */ + minWidth?: number; + + /** The widthGrow property should be used on columns without a width property set. The value is used to work out what fraction of the available will be allocated to the column. The value should be set to a number greater than 0, by default any columns with no width set have a widthGrow value of 1 */ + widthGrow?: number; + + /** The widthShrink property should be used on columns with a width property set. The value is used to work out how to shrink columns with a fixed width when the table is too narrow to fit in all the columns. The value should be set to a number greater than 0, by default columns with a width set have a widthShrink value of 0, meaning they will not be shrunk if the table gets too narrow, and may cause the horizontal scrollbar to appear. */ + widthShrink?: number; + + /** set whether column can be resized by user dragging its edges */ + resizable?: boolean; + /** You can freeze the position of columns on the left and right of the table using the frozen property in the column definition array. This will keep the column still when the table is scrolled horizontally. */ + frozen?: boolean; + /** an integer to determine when the column should be hidden in responsive mode */ + responsive?: number; + /** sets the on hover tooltip for each cell in this column * * The tooltip parameter can take three different types of value + boolean - a value of false disables the tooltip, a value of true sets the tooltip of the cell to its value + string - a string that will be displayed for all cells in the matching column/table. + function - a callback function that returns the string for the cell + * Note: setting a tooltip value on a column will override the global setting. + */ + tooltip?: string | GlobalTooltipOption; + /** sets css classes on header and cells in this column. (value should be a string containing space separated class names) */ + cssClass?: string; + /** sets the column as a row handle, allowing it to be used to drag movable rows. */ + rowHandle?: boolean; + /** When the getHtml function is called, hide the column from the output. */ + hideInHtml?: boolean; + + // Data Manipulation + /** By default Tabulator will attempt to guess which sorter should be applied to a column based on the data contained in the first row. It can determine sorters for strings, numbers, alphanumeric sequences and booleans, anything else will be treated as a string. + +To specify a sorter to be used on a column use the sorter property in the columns definition object + +You can pass an optional additional property with sorter, sorterParams that should contain an object with additional information for configuring the sorter*/ + sorter?: "string" | "number" | "alphanum" | "boolean" | "exists" | "date" | "time" | "datetime" | "array" | ((a: any, b: any, aRow: RowComponent, bRow: RowComponent, column: ColumnComponent, dir: SortDirection, sorterParams: {}) => number); + /** If you want to dynamically generate the sorterParams at the time the sort is called you can pass a function into the property that should return the params object. */ + sorterParams?: ColumnDefinitionSorterParams | ColumnSorterParamLookupFunction; + /** set how you would like the data to be formatted*/ + formatter?: Formatter; + /** You can pass an optional additional parameter with the formatter, formatterParams that should contain an object with additional information for configuring the formatter.*/ + formatterParams?: FormatterParams; + /** alter the row height to fit the contents of the cell instead of hiding overflow */ + variableHeight?: boolean; + /** There are some circumstances where you may want to block editibility of a cell for one reason or another. To meet this need you can use the editable option. This lets you set a callback that is executed before the editor is built, if this callback returns true the editor is added, if it returns false the edit is aborted and the cell remains a non editable cell. The function is passed one parameter, the CellComponent of the cell about to be edited. You can also pass a boolean value instead of a function to this property.*/ + editable?: boolean | ((cell: CellComponent) => boolean); + /** When a user clicks on an editable column the will be able to edit the value for that cell. + + By default Tabulator will use an editor that matches the current formatter for that cell. if you wish to specify a specific editor, you can set them per column using the editor option in the column definition. Passing a value of true to this option will result in Tabulator applying the editor that best matches the columns formatter, if present. + + You can pass an optional additional parameter with the editor, editorParams that should contain an object with additional information for configuring the editor. */ + editor?: Editor; + /** additional parameters you can pass to the editor */ + editorParams?: EditorParams; + + /** Validators are used to ensure that any user input into your editable cells matches your requirements. + + Validators can be applied by using the validator property in a columns definition object (see Define Columns for more details). */ + validator?: StandardValidatorType | StandardValidatorType[] | Validator | Validator[]; + + /** Mutators are used to alter data as it is parsed into Tabulator. For example if you wanted to convert a numeric column into a boolean based on its value, before the data is used to build the table. + + You can set mutators on a per column basis using the mutator option in the column definition object. + + You can pass an optional additional parameter with mutator, mutatorParams that should contain an object with additional information for configuring the mutator. */ + mutator?: CustomMutator; + /** You can pass an optional additional parameter with mutator, mutatorParams that should contain an object with additional information for configuring the mutator. */ + mutatorParams?: CustomMutatorParams; + /** only called when data is loaded via a command {eg. setData). */ + mutatorData?: CustomMutator; + mutatorDataParams?: CustomMutatorParams; + + /** only called when data is changed via a user editing a cell. */ + mutatorEdit?: CustomMutator; + mutatorEditParams?: CustomMutatorParams; + + /** only called when data is changed via a user editing a cell. */ + mutatorClipboard?: CustomMutator; + mutatorClipboardParams?: CustomMutatorParams; + + /** Accessors are used to alter data as it is extracted from the table, through commands, the clipboard, or download. + + You can set accessors on a per column basis using the accessor option in the column definition object.*/ + accessor?: CustomAccessor; + /** Each accessor function has its own matching params option, for example accessorDownload has accessorDownloadParams.*/ + accessorParams?: CustomAccessorParams; + /** only called when data is being converted into a downloadable file. */ + accessorDownload?: CustomAccessor; + /** additional parameters you can pass to the accessorDownload */ + accessorDownloadParams?: CustomAccessorParams; + + /** only called when data is being copied into the clipboard. */ + accessorClipboard?: CustomAccessor; + /** additional parameters you can pass to the accessorClipboard*/ + accessorClipboardParams?: CustomAccessorParams; + + /** show or hide column in downloaded data */ + download?: boolean; + /** set custom title for column in download */ + downloadTitle?: string; + + /** the column calculation to be displayed at the top of this column(see Column Calculations for more details) */ + topCalc?: ColumnCalc; + /** additional parameters you can pass to the topCalc calculation function (see Column Calculations for more details) */ + topCalcParams?: ColumnCalcParams; + /** formatter for the topCalc calculation cell */ + topCalcFormatter?: Formatter; + /** additional parameters you can pass to the topCalcFormatter function */ + topCalcFormatterParams?: FormatterParams; + + bottomCalc?: ColumnCalc; + bottomCalcParams?: ColumnCalcParams; + bottomCalcFormatter?: Formatter; + /** additional parameters you can pass to the bottomCalcFormatter function */ + bottomCalcFormatterParams?: FormatterParams; + + // Column Header + /** By default all columns in a table are sortable by clicking on the column header, if you want to disable this behaviour, set the headerSort property to false in the column definition array: */ + headerSort?: boolean; + /** set the starting sort direction when a user first clicks on a header */ + headerSortStartingDir?: SortDirection; + + /** allow tristate toggling of column header sort direction */ + headerSortTristate?: boolean; + + /** callback for when user clicks on the header for this column*/ + headerClick?: ColumnEventCallback; + /** callback for when user double clicks on the header for this column */ + headerDblClick?: ColumnEventCallback; + /** callback for when user right clicks on the header for this column */ + headerContext?: ColumnEventCallback; + /** callback for when user taps on a header for this column, triggered in touch displays. */ + headerTap?: ColumnEventCallback; + /** callback for when user double taps on a header for this column, triggered in touch displays when a user taps the same header twice in under 300ms */ + headerDblTap?: ColumnEventCallback; + /** callback for when user taps and holds on a header for this column, triggered in touch displays when a user taps and holds the same header for 1 second. */ + headerTapHold?: ColumnEventCallback; + /** sets the on hover tooltip for the column header* * The tooltip headerTooltip can take three different types of value + + boolean - a value of false disables the tooltip, a value of true sets the tooltip of the column header to its title value. + string - a string that will be displayed for the tooltip. + function - a callback function that returns the string for the column header* + */ + headerTooltip?: boolean | string | ((column: ColumnComponent) => string); + /** change the orientation of the column header to vertical* * The headerVertical property can take one of three values: + + false - vertical columns disabled (default value) + true - vertical columns enabled + "flip" - vertical columns enabled, with text direction flipped by 180 degrees* + */ + headerVertical?: boolean | "flip"; + + /** allows the user to edit the header titles */ + editableTitle?: boolean; + /** formatter function for header title */ + titleFormatter?: Formatter; + + /** additional parameters you can pass to the header title formatter */ + titleFormatterParams?: FormatterParams; + /** filtering of columns from elements in the header */ + headerFilter?: Editor; + /** additional parameters you can pass to the header filter */ + headerFilterParams?: EditorParams; + + /** placeholder text for the header filter */ + headerFilterPlaceholder?: string; + + /** function to check when the header filter is empty */ + headerFilterEmptyCheck?: ValueBooleanCallback; + /** By default Tabulator will try and match the comparison type to the type of element used for the header filter. + + Standard input elements will use the "like" filter, this allows for the matches to be displayed as the user types. + + For all other element types (select boxes, check boxes, input elements of type number) an "=" filter type is used. + + If you want to specify the type of filter used you can pass it to the headerFilterFunc option in the column definition object. This will take any of the standard filters outlined above or a custom function*/ + headerFilterFunc?: FilterType | ((headerValue: any, rowValue: any, rowdata: any, filterparams: any) => boolean); + /** additional parameters object passed to the headerFilterFunc function */ + headerFilterFuncParams?: any; + + /** disable live filtering of the table */ + headerFilterLiveFilter?: boolean; + } + + interface CellCallbacks { + // Cell Events + /** callback for when user clicks on a cell in this column */ + cellClick?: CellEventCallback; + /** callback for when user double clicks on a cell in this column */ + cellDblClick?: CellEventCallback; + /** callback for when user right clicks on a cell in this column */ + cellContext?: CellEventCallback; + /** callback for when user taps on a cell in this column, triggered in touch displays. */ + cellTap?: CellEventCallback; + /** callback for when user double taps on a cell in this column, triggered in touch displays when a user taps the same cell twice in under 300ms. */ + cellDblTap?: CellEventCallback; + /** callback for when user taps and holds on a cell in this column, triggered in touch displays when a user taps and holds the same cell for 1 second.*/ + cellTapHold?: CellEventCallback; + + /** callback for when the mouse pointer enters a cell */ + cellMouseEnter?: CellEventCallback; + /** callback for when the mouse pointer leaves a cell */ + cellMouseLeave?: CellEventCallback; + + /** callback for when the mouse pointer enters a cell or one of its child elements */ + cellMouseOver?: CellEventCallback; + + /** callback for when the mouse pointer enters a cell or one of its child elements */ + cellMouseOut?: CellEventCallback; + + /** callback for when the mouse pointer moves over a cell */ + cellMouseMove?: CellEventCallback; + + // Cell editing + /** callback for when a cell in this column is being edited by the user */ + cellEditing?: CellEditEventCallback; + + /** callback for when a cell in this column has been edited by the user */ + cellEdited?: CellEditEventCallback; + + /** callback for when an edit on a cell in this column is aborted by the user */ + cellEditCancelled?: CellEditEventCallback; + } + + interface ColumnDefinitionSorterParams { + format?: string; + locale?: string | boolean; + alignEmptyValues?: "top" | "bottom"; + type?: "length" | "sum" | "max" | "min" | "avg"; + } + + type GlobalTooltipOption = boolean | ((cell: CellComponent) => string); + type CustomMutator = (value: any, data: any, type: "data" | "edit", mutatorParams: any, cell?: CellComponent) => any; + type CustomMutatorParams = {} | ((value: any, data: any, type: "data" | "edit", cell?: CellComponent) => any); + type CustomAccessor = (value: any, data: any, type: "data" | "download" | "clipboard", AccessorParams: any, column?: ColumnComponent) => any; + type CustomAccessorParams = {} | ((value: any, data: any, type: "data" | "download" | "clipboard", column?: ColumnComponent) => any); + type ColumnCalc = "avg" | "max" | "min" | "sum" | "concat" | "count" | ((values: any[], data: any[], calcParams: {}) => number); + type ColumnCalcParams = (values: any, data: any) => any; + type Formatter = "plaintext" | "textarea" | "html" | "money" | "image" | "datetime" | "datetimediff" | "link" | "tickCross" | "color" | "star" | "traffic" | "progress" | "lookup" | "buttonTick" | "buttonCross" | "rownum" | "handle" | ((cell: CellComponent, formatterParams: {}, onRendered: EmptyCallback) => string | HTMLElement); + type FormatterParams = MoneyParams | ImageParams | LinkParams | DateTimeParams | DateTimeDifferenceParams | TickCrossParams | TrafficParams | StarRatingParams | JSONRecord | ((cell: CellComponent) => {}); + + type Editor = true | "input" | "textarea" | "number" | "range" | "tick" | "star" | "select" | "autocomplete" | ((cell: CellComponent, onRendered: EmptyCallback, success: ValueVoidCallback, cancel: ValueVoidCallback, editorParams: {}) => HTMLElement | false); + + type EditorParams = NumberParams | CheckboxParams | SelectParams | AutoCompleteParams | ((cell: CellComponent) => {}); + + type ScrollToRowPostition = "top" | "center" | "bottom" | "nearest"; + type ScrollToColumnPosition = "left" | "center" | "middle" | "right"; + + interface MoneyParams { + // Money + decimal?: string; + thousand?: string; + symbol?: string; + symbolAfter?: boolean; + precision?: boolean | number; + } + interface ImageParams { + // Image + height?: string; + width?: string; + } + interface LinkParams { + // Link + labelField?: string; + label?: string; + urlPrefix?: string; + urlField?: string; + url?: string; + target?: string; + } + + interface DateTimeParams { + // datetime + inputFormat?: string; + outputFormat?: string; + invalidPlaceholder?: true | string | number | ValueStringCallback; + } + + interface DateTimeDifferenceParams extends DateTimeParams { + // Date Time Difference + date?: any; + humanize?: boolean; + unit?: "years" | "months" | "weeks" | "days" | "hours" | "minutes" | "seconds"; + suffix?: boolean; + } + interface TickCrossParams { + // Tick Cross + allowEmpty?: boolean; + allowTruthy?: boolean; + tickElement?: boolean | string; + crossElement?: boolean | string; + } + + interface TrafficParams { + // Traffic + min?: number; + max?: number; + color?: Color; + } + interface ProgressBarParams extends TrafficParams { + // Progress Bar + legend?: string | true | ValueStringCallback; + legendColor?: Color; + legendAlign?: Align; + } + + interface StarRatingParams { + // Star Rating + stars?: number; + } + + interface NumberParams { + // range,number + min?: number; + max?: number; + step?: number; + } + + interface CheckboxParams { + // tick + tristate?: boolean; + indeterminateValue?: string; + } + + interface SelectParams { + values: true | string[] | JSONRecord | SelectParamsGroup[]; + listItemFormatter?: (value: string, text: string) => string; + } + + interface SelectParamsGroup { + label: string; + value?: string | number | boolean; + options?: SelectLabelValue[]; + } + interface SelectLabelValue { + label: string; + value: string | number | boolean; + } + + interface AutoCompleteParams { + values: true | string[] | JSONRecord; + listItemFormatter?: (value: string, text: string) => string; + searchFunc: (term: string, values: string[]) => string[]; + allowEmpty?: boolean; + freetext?: boolean; + showListOnEmpty?: boolean; + } + + type ValueStringCallback = (value: any) => string; + type ValueBooleanCallback = (value: any) => boolean; + type ValueVoidCallback = (value: any) => void; + type EmptyCallback = (callback: () => void) => void; + type CellEventCallback = (e: any, cell: CellComponent) => void; + type CellEditEventCallback = (cell: CellComponent) => void; + type ColumnEventCallback = (e: any, column: ColumnComponent) => void; + type RowEventCallback = (e: any, row: RowComponent) => void; + type RowChangedCallback = (row: RowComponent) => void; + type GroupEventCallback = (e: any, group: GroupComponent) => void; + + type SortDirection = "asc" | "desc"; + type FilterType = "=" | "!=" | "like" | "<" | ">" | "<=" | ">=" | "in" | "regex"; + type Color = string | any[] | ValueStringCallback; + type Align = "center" | "left" | "right" | "justify"; + + type JSONRecord = Record; + + type StandardValidatorType = "required" | "unique" | "integer" | "float" | "numeric" | "string"; + interface Validator { + type: StandardValidatorType | ((cell: CellComponent, value: any, parameters?: any) => boolean); + parameters?: any; + } + + type ColumnSorterParamLookupFunction = (column: ColumnComponent, dir: SortDirection) => {}; + + type ColumnLookup = ColumnComponent | ColumnDefinition | HTMLElement | string; + type RowLookup = RowComponent | HTMLElement | string | number; + + interface KeyBinding { + navPrev?: string | boolean; + navNext?: string | boolean; + navLeft?: string | boolean; + navRight?: string | boolean; + navUp?: string | boolean; + navDown?: string | boolean; + undo?: string | boolean; + redo?: string | boolean; + scrollPageUp?: string | boolean; + scrollPageDown?: string | boolean; + scrollToStart?: string | boolean; + scrollToEnd?: string | boolean; + copyToClipboard?: string | boolean; + } + + // Components------------------------------------------------------------------- + + interface CellNavigation { + /** prev - next editable cell on the left, if none available move to the right most editable cell on the row above */ + prev: () => boolean; + /** next - next editable cell on the right, if none available move to left most editable cell on the row below */ + next: () => boolean; + /** left - next editable cell on the left, return false if none available on row */ + left: () => boolean; + /** right - next editable cell on the right, return false if none available on row */ + right: () => boolean; + /** up - move to the same cell in the row above */ + up: () => void; + /** down - move to the same cell in the row below */ + down: () => void; + } + + interface RowComponent { + /** The getData function returns the data object for the row.*/ + getData: () => {}; + /** The getElement function returns the DOM node for the row.*/ + getElement: () => HTMLElement; + + /** The getTable function returns the Tabulator object for the table containing the row. */ + getTable: () => Tabulator; + + /** The getNextRow function returns the Row Component for the next visible row in the table, if there is no next row it will return a value of false */ + getNextRow: () => RowComponent | false; + /** The getNextRow function returns the Row Component for the previous visible row in the table, if there is no next row it will return a value of false */ + getPrevRow: () => RowComponent | false; + + /** The getCells function returns an array of CellComponent objects, one for each cell in the row.*/ + getCells: () => CellComponent[]; + /** The getCell function returns the CellComponent for the specified column from this row.*/ + getCell: (column: ColumnComponent | HTMLElement | string) => CellComponent; + /** The getIndex function returns the index value for the row. (this is the value from the defined index column, NOT the row's position in the table)*/ + getIndex: () => any; + + /** Use the getPosition function to retrieve the numerical position of a row in the table. By default this will return the position of the row in all data, including data currently filtered out of the table. + + If you want to get the position of the row in the currently filtered/sorted data, you can pass a value of true to the optional first argument of the function. */ + getPosition: (filteredPosition?: boolean) => number; + + /** When using grouped rows, you can retrieve the group component for the current row using the getGroup function. */ + getGroup: () => GroupComponent; + /** The delete function deletes the row, removing its data from the table + * + * The delete method returns a promise, this can be used to run any other commands that have to be run after the row has been deleted. By running them in the promise you ensure they are only run after the row has been deleted. + */ + delete: () => Promise; + /** The scrollTo function will scroll the table to the row if it passes the current filters.*/ + scrollTo: () => Promise; + + /** The pageTo function will load the page for the row if it passes the current filters.*/ + pageTo: () => Promise; + + /** You can move a row next to another row using the move function. + + The first argument should be the target row that you want to move to, and can be any of the standard row component look up options. + + The second argument determines whether the row is moved to above or below the target row. A value of false will cause to the row to be placed below the target row, a value of true will result in the row being placed above the target*/ + + move: (lookup: RowComponent | HTMLElement | number, belowTarget?: boolean) => void; + + /** You can update the data in the row using the update function. You should pass an object to the function containing any fields you wish to update. This object will not replace the row data, only the fields included in the object will be updated.*/ + update: (data: {}) => Promise; + /** The select function will select the current row.*/ + select: () => void; + /** The deselect function will deselect the current row.*/ + deselect: () => void; + /** The deselect function will toggle the current row.*/ + toggleSelect: () => void; + /** The isSelected function will return a boolean representing the current selected state of the row. */ + isSelected: () => boolean; + /** If you are making manual adjustments to elements contained within the row, it may sometimes be necessary to recalculate the height of all the cells in the row to make sure they remain aligned. Call the normalizeHeight function to do this.*/ + normalizeHeight: () => void; + + /** If you want to re-format a row once it has been rendered to re-trigger the cell formatters and the rowFormatter callback, Call the reformat function. */ + reformat: () => void; + + /** You can freeze a row at the top of the table by calling the freeze function. This will insert the row above the scrolling portion of the table in the table header. */ + freeze: () => void; + + /** A frozen row can be unfrozen using the unfreeze function. This will remove the row from the table header and re-insert it back in the table. */ + unfreeze: () => void; + + /** When the tree structure is enabled the treeExpand function will expand current row and show its children. */ + treeExpand: () => void; + + /** When the tree structure is enabled the treeCollapse function will collapse current row and hide its children */ + treeCollapse: () => void; + + /** When the tree structure is enabled the treeToggle function will toggle the collapsed state of the current row. */ + treeToggle: () => void; + + /** When the tree structure is enabled the getTreeParent function will return the Row Component for the parent of this row. If no parent exists, a value of false will be returned. */ + getTreeParent: () => RowComponent | false; + /** When the tree structure is enabled the getTreeChildren function will return an array of Row Components for this rows children. */ + getTreeChildren: () => RowComponent[]; + } + + interface GroupComponent { + /** The getElement function returns the DOM node for the group header. */ + getElement: () => HTMLElement; + + /** The getTable function returns the Tabulator object for the table containing the group */ + getTable: () => Tabulator; + + /** The getKey function returns the unique key that is shared between all rows in this group. */ + getKey: () => any; + + /** The getRows function returns an array of RowComponent objects, one for each row in the group */ + getRows: () => RowComponent[]; + + /** The getSubGroups function returns an array of GroupComponent objects, one for each sub group of this group. */ + getSubGroups: () => GroupComponent[]; + + /** The getParentGroup function returns the GroupComponent for the parent group of this group. if no parent exists, this function will return false */ + getParentGroup: () => GroupComponent | false; + + /** The getVisibility function returns a boolean to show if the group is visible, a value of true means it is visible.*/ + getVisibility: () => boolean; + + /** The show function shows the group if it is hidden. */ + show: () => void; + /** The hide function hides the group if it is visible. */ + hide: () => void; + /** The toggle function toggles the visibility of the group, switching between hidden and visible. */ + toggle: () => void; + } + + interface ColumnComponent { + /*The getElement function returns the DOM node for the colum*/ + getElement: () => HTMLElement; + /** The getTable function returns the Tabulator object for the table containing the column */ + getTable: () => Tabulator; + /** The getDefinition function returns the column definition object for the column.*/ + getDefinition: () => ColumnDefinition; + /** The getField function returns the field name for the column.*/ + getField: () => string; + /** The getCells function returns an array of CellComponent objects, one for each cell in the column.*/ + getCells: () => CellComponent[]; + + /** The getNextColumn function returns the Column Component for the next visible column in the table, if there is no next column it will return a value of false. */ + getNextColumn: () => ColumnComponent | false; + /** The getPrevColumn function returns the Column Component for the previous visible column in the table, if there is no previous column it will return a value of false. */ + getPrevColumn: () => ColumnComponent | false; + /** The getVisibility function returns a boolean to show if the column is visible, a value of true means it is visible.*/ + getVisibility: () => boolean; + /** The show function shows the column if it is hidden.*/ + show: () => void; + /** The hide function hides the column if it is visible.*/ + hide: () => void; + /** The toggle function toggles the visibility of the column, switching between hidden and visible.*/ + toggle: () => void; + /** The delete function deletes the column, removing it from the table*/ + delete: () => void; + /** The scrollTo function will scroll the table to the column if it is visible. */ + scrollTo: () => Promise; + /** The getSubColumns function returns an array of ColumnComponent objects, one for each sub column of this column. */ + getSubColumns: () => ColumnComponent[]; + + /** The getParentColumn function returns the ColumnComponent for the parent column of this column. if no parent exists, this function will return false */ + getParentColumn: () => ColumnComponent | false; + /** The headerFilterFocus function will place focus on the header filter element for this column if it exists. */ + headerFilterFocus: () => void; + /** The setHeaderFilterValue function set the value of the columns header filter element to the value provided in the first argument. */ + setHeaderFilterValue: (value: any) => void; + /** The reloadHeaderFilter function rebuilds the header filter element, updating any params passed into the editor used to generate the filter. */ + reloadHeaderFilter: () => void; + } + + interface CellComponent { + /** The getValue function returns the current value for the cell. */ + getValue: () => any; + /** The getOldValue function returns the previous value of the cell. Very usefull in the event of cell update callbacks. */ + getOldValue: () => any; + /** The restoreOldValue reverts the value of the cell back to its previous value, without triggering any of the cell edit callbacks. */ + restoreOldValue: () => any; + /** The getElement function returns the DOM node for the cell. */ + + getElement: () => HTMLElement; + /** The getTable function returns the Tabulator object for the table containing the cell. */ + getTable: () => Tabulator; + /** The getRow function returns the RowComponent for the row that contains the cell. */ + getRow: () => RowComponent; + + /** The getColumn function returns the ColumnComponent for the column that contains the cell. */ + getColumn: () => ColumnComponent; + + /** The getData function returns the data for the row that contains the cell. */ + getData: () => {}; + /** The getField function returns the field name for the column that contains the cell. */ + getField: () => string; + /** You can change the value of the cell using the setValue function. The first parameter should be the new value for the cell, the second optional parameter will apply the column mutators to the value when set to true (default = true). */ + setValue: (value: any, mutate?: boolean) => void; + /** If you are making manual adjustments to elements contained withing the cell, or the cell itself, it may sometimes be necessary to recalculate the height of all the cells in the row to make sure they remain aligned. Call the checkHeight function to check if the height of the cell has changed and normalize the row if it has. */ + checkHeight: () => void; + /** You and programatically cause a cell to open its editor element using the edit function */ + edit: (ignoreEditable?: boolean) => void; + /** You and programatically cancel a cell edit that is currently in progress by calling the cancelEdit function */ + cancelEdit: () => void; + /** When a cell is being edited it is possible to move the editor focus from the current cell to one if its neighbours. There are a number of functions that can be called on the nav function to move the focus in different directions. */ + nav: () => CellNavigation; + } +} + +// Tabulator.prototype.(?!registerModule|helpers|_)\w+ +declare class Tabulator { + constructor(selector: string | HTMLElement, options?: Tabulator.Options); + + columnManager: any; + rowManager: any; + footerManager: any; + browser: string; + browserSlow: boolean; + modules: any; + options: Tabulator.Options; + + /** You have a choice of four file types to choose from: + csv - Comma separated value file + json - JSON formatted text file + xlsx - Excel File (Requires the SheetJS Library) + pdf - PDF File (Requires the jsPDF Library and jsPDF-AutoTable Plugin) + To trigger a download, call the download function, passing the file type (from the above list) as the first argument, and an optional second argument of the file name for the download (if this is left out it will be "Tabulator.ext"). The optional third argument is an object containing any setup options for the formatter, such as the delimiter choice for CSV's). + + The PDF downloader requires that the jsPDF Library and jsPDF-AutoTable Plugin be included on your site, this can be included with the following script tags. + + If you want to create a custom file type from the table data then you can pass a function to the type argument, instead of a string value. At the end of this function you must call the setFileContents function, passing the formatted data and the mime type. + */ + download: (downloadType: Tabulator.DownloadType | ((columns: Tabulator.ColumnDefinition[], data: any, options: any, setFileContents: any) => any), fileName: string, params?: Tabulator.DownloadOptions) => void; + + /** If you want to open the generated file in a new browser tab rather than downloading it straight away, you can use the downloadToTab function. This is particularly useful with the PDF downloader, as it allows you to preview the resulting PDF in a new browser ta */ + downloadToTab: (downloadType: Tabulator.DownloadType, fileName: string, params?: Tabulator.DownloadOptions) => void; + + /** The copyToClipboard function allows you to copy the current table data to the clipboard. + + The first argument is the copy selector, you can choose from any of the built in options or pass a function in to the argument, that must return the selected row components. + + If you leave this argument undefined, Tabulator will use the value of the clipboardCopySelector property, which has a default value of table */ + copyToClipboard: (type: "selection" | "table") => void; + + /** With history enabled you can use the undo function to automatically undo a user action, the more times you call the function, the further up the history log you go. */ + undo: () => boolean; + + /** You can use the getHistoryUndoSize function to get a count of the number of history undo actions available. */ + getHistoryUndoSize: () => number | false; + + /** With history enabled you can use the redo function to automatically redo user action that has been undone, the more times you call the function, the further up the history log you go. once a user interacts with the table then can no longer redo any further actions until an undo is performe */ + redo: () => boolean; + + /** You can use the getHistoryRedoSize function to get a count of the number of history redo actions available.*/ + getHistoryRedoSize: () => number | false; + /** Deconstructor */ + destroy: () => void; + /** By default Tabulator will only allow files with a .json extension to be loaded into the table. + + You can allow any other type of file into the file picker by passing the extension or mime type into the first argument of the setDataFromLocalFile function as a comma separated list. This argument will accept any of the values valid for the accept field of an input element */ + setDataFromLocalFile: (extensions: string) => void; + setData: (data: any, params?: any, config?: any) => Promise; + /** You can remove all data from the table using clearData */ + clearData: () => void; + /** You can retrieve the data stored in the table using the getData function. */ + getData: (activeOnly?: boolean) => any[]; + getDataCount: (activeOnly?: boolean) => number; + /** The searchRows function allows you to retreive an array of row components that match any filters you pass in. it accepts the same arguments as the setFilter function. */ + searchRows: Tabulator.FilterFunction; + /** The searchData function allows you to retreive an array of table row data that match any filters you pass in. it accepts the same arguments as the setFilter function. */ + searchData: Tabulator.FilterFunction; + /** You can retrieve the table data as a simple HTML table using the getHtml function. */ + getHtml: (activeOnly?: boolean) => void; + /** You can retrieve the current AJAX URL of the table with the getAjaxUrl function. + * + * This will return a HTML encoded string of the table data. + + By default getHtml will return a table containing all the data held in the Tabulator. If you only want to access the currently filtered/sorted elements, you can pass a value of true to the first argument of the function. + */ + getAjaxUrl: () => string; + /** The replaceData function lets you silently replace all data in the table without updating scroll position, sort or filtering, and without triggering the ajax loading popup. This is great if you have a table you want to periodically update with new/updated information without alerting the user to a change. + + It takes the same arguments as the setData function, and behaves in the same way when loading data (ie, it can make ajax requests, parse JSON etc) */ + replaceData: (data?: Array<{}> | string, params?: any, config?: any) => Promise; + /** If you want to update an existing set of data in the table, without completely replacing the data as the setData method would do, you can use the updateData method. + + This function takes an array of row objects and will update each row based on its index value. (the index defaults to the "id" parameter, this can be set using the index option in the tabulator constructor). Options without an index will be ignored, as will items with an index that is not already in the table data. The addRow function should be used to add new data to the table. */ + updateData: (data: Array<{}>) => Promise; + /** The addData method returns a promise, this can be used to run any other commands that have to be run after the data has been loaded into the table. By running them in the promise you ensure they are only run after the table has loaded the data. */ + addData: (data?: Array<{}>, addToTop?: boolean, positionTarget?: Tabulator.RowLookup) => Promise; + + /** If the data you are passng to the table contains a mix of existing rows to be updated and new rows to be added then you can call the updateOrAddData function. This will check each row object provided and update the existing row if available, or else create a new row with the data. */ + updateOrAddData: (data: Array<{}>) => Promise; + /** To rereive the DOM Node of a specific row, you can retrieve the RowComponent with the getRow function, then use the getElement function on the component. The first argument is the row you are looking for, it will take any of the standard row component look up options. */ + getRow: (row: Tabulator.RowLookup) => Tabulator.RowComponent; + + /** You can retrieve the Row Component of a row at a given position in the table using getRowFromPosition function. By default this will return the row based in its position in all table data, including data currently filtered out of the table. + + If you want to get a row based on its position in the currently filtered/sorted data, you can pass a value of true to the optional second argument of the function. */ + getRowFromPosition: (position: number, activeOnly?: boolean) => void; + /** You can delete any row in the table using the deleteRow function. */ + deleteRow: (row: Tabulator.RowLookup) => void; + + /** You can add a row to the table using the addRow function. + + The first argument should be a row data object. If you do not pass data for a column, it will be left empty. To create a blank row (ie for a user to fill in), pass an empty object to the function. + + The second argument is optional and determines whether the row is added to the top or bottom of the table. A value of true will add the row to the top of the table, a value of false will add the row to the bottom of the table. If the parameter is not set the row will be placed according to the addRowPos global option. */ + addRow: (data?: {}, addToTop?: boolean, positionTarget?: Tabulator.RowLookup) => Promise; + /** If you don't know whether a row already exists you can use the updateOrAddRow function. This will check if a row with a matching index exists, if it does it will update it, if not it will add a new row with that data. This takes the same arguments as the updateRow function. */ + updateOrAddRow: (row: Tabulator.RowLookup, data: {}) => Promise; + /** You can update any row in the table using the updateRow function. + + The first argument is the row you want to update, it will take any of the standard row component look up options. + + The second argument should be the updated data object for the row. As with the updateData function, this will not replace the existing row data object, it will only update any of the provided parameters. + + Once complete, this function will trigger the rowUpdated and dataEdited events. + + This function will return true if the update was successful or false if the requested row could not be found. If the new data matches the existing row data, no update will be performed. + */ + updateRow: (row: Tabulator.RowLookup, data: {}) => boolean; + /** If you want to trigger an animated scroll to a row then you can use the scrollToRow function. + + The first argument should be any of the standard row component look up options for the row you want to scroll to. + + The second argument is optional, and is used to set the position of the row, it should be a string with a value of either top, center, bottom or nearest, if omitted it will be set to the value of the scrollToRowPosition option which has a default value of top. + + The third argument is optional, and is a boolean used to set if the table should scroll if the row is already visible, true to scroll, false to not, if omitted it will be set to the value of the scrollToRowIfVisible option, which defaults to true */ + scrollToRow: (row: Tabulator.RowLookup, position?: Tabulator.ScrollToRowPostition, ifVisible?: boolean) => Promise; + /** If you want to programmatically move a row to a new position you can use the moveRow function. + + The first argument should be the row you want to move, and can be any of the standard row component look up options. + + The second argument should be the target row that you want to move to, and can be any of the standard row component look up options. + + The third argument determines whether the row is moved to above or below the target row. A value of false will cause to the row to be placed below the target row, a value of true will result in the row being placed above the target */ + moveRow: (fromRow: Tabulator.RowLookup, toRow: Tabulator.RowLookup, placeAboveTarget?: boolean) => void; + /** You can retrieve all the row components in the table using the getRows function.* By default getRows will return an array containing all the Row Component's held in the Tabulator. If you only want to access the currently filtered/sorted elements, you can pass a value of true to the first argument of the function. + */ + getRows: (activeOnly?: boolean) => Tabulator.RowComponent[]; + /** Use the getRowPosition function to retrieve the numerical position of a row in the table. By default this will return the position of the row in all data, including data currently filtered out of the table. + + The first argument is the row you are looking for, it will take any of the standard row component look up options. If you want to get the position of the row in the currently filtered/sorted data, you can pass a value of true to the optional second argument of the function. + + Note: If the row is not found, a value of -1 will be returned, row positions start at 0 + */ + getRowPosition: (row: Tabulator.RowLookup, activeOnly?: boolean) => number; + /** To replace the current column definitions for a table use the setColumns function. This function takes a column definition array as its only argument. */ + setColumns: (definitions: Tabulator.ColumnDefinition[]) => void; + /** To get an array of Column Components for the current table setup, call the getColumns function. This will only return actual data columns not column groups. + ** To get a structured array of Column Components that includes column groups, pass a value of true as an argument. + */ + getColumns: (includeColumnGroups?: boolean) => Tabulator.ColumnComponent[] | Tabulator.GroupComponent[]; + /** Using the getColumn function you can retrieve the Column Component */ + getColumn: (column: Tabulator.ColumnLookup) => Tabulator.ColumnComponent; + /** To get the current column definition array (including any changes made through user actions, such as resizing or re-ordering columns), call the getColumnDefinitions function. this will return the current columns definition array. */ + getColumnDefinitions: () => Tabulator.ColumnDefinition[]; + /** If you want to handle column layout persistence manually, for example storing it in a database to use elsewhere, you can use the getColumnLayout function to retrieve a layout object for the current table. */ + getColumnLayout: () => Tabulator.ColumnLayout[]; + /** If you have previously used the getColumnLayout function to retrieve a tables layout, you can use the setColumnLayout function to apply it to a table. */ + setColumnLayout: (layout: Tabulator.ColumnLayout) => void; + /** You can show a hidden column at any point using the showColumn function. */ + showColumn: (column?: Tabulator.ColumnLookup) => void; + /** You can hide a visible column at any point using the hideColumn function. */ + hideColumn: (column?: Tabulator.ColumnLookup) => void; + /** You can toggle the visibility of a column at any point using the toggleColumn function. */ + toggleColumn: (column?: Tabulator.ColumnLookup) => void; + /** If you wish to add a single column to the table, you can do this using the addColumn function. + * This function takes three arguments: + + Columns Definition - The column definition object for the column you want to add. + Before (optional) - Determines how to position the new column. A value of true will insert the column to the left of existing columns, a value of false will insert it to the right. If a Position argument is supplied then this will determine whether the new colum is inserted before or after this column. + Position (optional) - The field to insert the new column next to, this can be any of the standard column component look up options. +* + */ + addColumn: (definition: Tabulator.ColumnDefinition, insertRightOfTarget?: boolean, positionTarget?: Tabulator.ColumnLookup) => void; + /** To permanently remove a column from the table deleteColumn function. This function takes any of the standard column component look up options as its first parameter */ + deleteColumn: (column: Tabulator.ColumnLookup) => void; + /** If you want to trigger an animated scroll to a column then you can use the scrollToColumn function. The first argument should be any of the standard column component look up options for the column you want to scroll to. + + The second argument is optional, and is used to set the position of the column, it should be a string with a value of either left, middle or right, if omitted it will be set to the value of the scrollToColumnPosition option which has a default value of left. + + The third argument is optional, and is a boolean used to set if the table should scroll if the column is already visible, true to scroll, false to not, if omitted it will be set to the value of the scrollToColumnIfVisible option, which defaults to true + */ + scrollToColumn: (column: Tabulator.ColumnLookup, position?: Tabulator.ScrollToColumnPosition, ifVisible?: boolean) => Promise; + /** You can also set the language at any point after the table has loaded using the setLocale function, which takes the same range of values as the locale setup option mentioned above. */ + setLocale: (locale: string | boolean) => void; + /** It is possible to retrieve the locale code currently being used by Tabulator using the getLocale function: */ + getLocale: () => string; + /** You can then access these at any point using the getLang function, which will return the language object for the currently active locale. */ + getLang: (locale?: string) => any; + /** If the size of the element containing the Tabulator changes (and you are not able to use the in built auto-resize functionality) or you create a table before its containing element is visible, it will necessary to redraw the table to make sure the rows and columns render correctly. + + This can be done by calling the redraw method. For example, to trigger a redraw whenever the viewport width is changed. + + The redraw function also has an optional boolean argument that when set to true triggers a full rerender of the table including all data on all rows.*/ + redraw: (force?: boolean) => void; + /** If you want to manually change the height of the table at any time, you can use the setHeight function, which will also redraw the virtual DOM if necessary. */ + setHeight: (height: number) => void; + /** You can trigger sorting using the setSort function */ + setSort: (sortList: string | Tabulator.Sorter[], dir?: Tabulator.SortDirection) => void; + getSorters: () => void; + /** To remove all sorting from the table, call the clearSort function. */ + clearSort: () => void; + /** To set a filter you need to call the setFilter method, passing the field you wish to filter, the comparison type and the value to filter for. + + This function will replace any exiting filters on the table with the specified filter + + If you want to perform a more complicated filter then you can pass a callback function to the setFilter method, you can also pass an optional second argument, an object with parameters to be passed to the filter function. + */ + setFilter: (p1: string | Tabulator.Filter[] | any[] | ((data: any, filterParams: any) => boolean), p2?: Tabulator.FilterType | {}, value?: any) => void; + /** If you want to add another filter to the existing filters then you can call the addFilter function: */ + addFilter: Tabulator.FilterFunction; + /** You can retrieve an array of the current programtic filters using the getFilters function, this will not include any of the header filters: */ + getFilters: (includeHeaderFilters: boolean) => Tabulator.Filter[]; + /** You can programatically set the header filter value of a column by calling the setHeaderFilterValue function, This function takes any of the standard column component look up options as its first parameter, with the value for the header filter as the second option */ + setHeaderFilterValue: (column: Tabulator.ColumnLookup, value: string) => void; + + /** You can programatically set the focus on a header filter element by calling the setHeaderFilterFocus function, This function takes any of the standard column component look up options as its first parameter */ + setHeaderFilterFocus: (column: Tabulator.ColumnLookup) => void; + /** If you just want to retrieve the current header filters, you can use the getHeaderFilters function: */ + getHeaderFilters: () => Tabulator.Filter[]; + /** If you want to remove one filter from the current list of filters you can use the removeFilter function: */ + removeFilter: Tabulator.FilterFunction; + /** To remove all filters from the table, use the clearFilter function. */ + clearFilter: (includeHeaderFilters: boolean) => void; + /** To remove just the header filters, leaving the programatic filters in place, use the clearHeaderFilter function. */ + clearHeaderFilter: () => void; + /** To programmatically select a row you can use the selectRow function. + + To select a specific row you can pass the any of the standard row component look up options into the first argument of the function. If you leave the argument blank you will select all rows (if you have set the selectable option to a numeric value, it will be ignored when selecting all rows). */ + selectRow: (row?: Tabulator.RowLookup) => void; + deselectRow: (row?: Tabulator.RowLookup) => void; + toggleSelectRow: (row?: Tabulator.RowLookup) => void; + /** To get the RowComponent's for the selected rows at any time you can use the getSelectedRows function. + + This will return an array of RowComponent's for the selected rows in the order in which they were selected. */ + getSelectedRows: () => Tabulator.RowComponent[]; + /** To get the data objects for the selected rows you can use the getSelectedData function. + + This will return an array of the selected rows data objects in the order in which they were selected */ + getSelectedData: () => any[]; + /** set the maxmum page */ + setMaxPage: (max: number) => void; + /** When pagination is enabled the table footer will contain a number of pagination controls for navigating through the data. + + In addition to these controls it is possible to change page using the setPage function + The setPage function takes one parameter, which should be an integer representing the page you wish to see. There are also four strings that you can pass into the parameter for special functions. + + "first" - show the first page + "prev" - show the previous page + "next" - show the next page + "last" - show the last page + The setPage method returns a promise, this can be used to run any other commands that have to be run after the data has been loaded into the table. By running them in the promise you ensure they are only run after the table has loaded the data. + */ + setPage: (page: number | "first" | "prev" | "next" | "last") => Promise; + /** You can load the page for a specific row using the setPageToRow function and passing in any of the standard row component look up options for the row you want to scroll to. + ** The setPageToRow method returns a promise, this can be used to run any other commands that have to be run after the data has been loaded into the table. By running them in the promise you ensure they are only run after the table has loaded the data. + */ + setPageToRow: (row: Tabulator.RowLookup) => Promise; + + /** You can change the page size at any point by using the setPageSize function. (this setting will be ignored if using remote pagination with the page size set by the server) */ + setPageSize: (size: number) => void; + /** To retrieve the number of rows allowed per page you can call the getPageSize function: */ + getPageSize: () => number; + /** You can change to show the previous page using the previousPage function. */ + previousPage: () => Promise; + /** You can change to show the next page using the previousPage function. */ + + nextPage: () => Promise; + /** To retrieve the current page use the getPage function. this will return the number of the current page. If pagination is disabled this will return false. */ + getPage: () => number | false; + /** To retrieve the maximum available page use the getPageMax function. this will return the number of the maximum available page. If pagination is disabled this will return false. */ + getPageMax: () => number | false; + /** You can use the setGroupBy function to change the fields that rows are grouped by. This function has one argument and takes the same values as passed to the groupBy setup option. */ + setGroupBy: (groups: string | ((data: any) => any)) => void; + /** You can use the setGroupStartOpen function to change the default open state of groups. This function has one argument and takes the same values as passed to the groupStartOpen setup option. + ** Note: If you use the setGroupStartOpen or setGroupHeader before you have set any groups on the table, the table will not update until the setGroupBy function is called. + */ + setGroupStartOpen: (values: boolean | ((value: any, count: number, data: any, group: Tabulator.GroupComponent) => boolean)) => void; + /** You can use the setGroupHeader function to change the header generation function for each group. This function has one argument and takes the same values as passed to the groupHeader setup option. */ + setGroupHeader: (values: ((value: any, count: number, data: any, group: Tabulator.GroupComponent) => string) | Array<(value: any, count: number, data: any) => string>) => void; + /** You can use the getGroups function to retrieve an array of all the first level Group Components in the table. */ + getGroups: () => Tabulator.GroupComponent[]; + /** get grouped table data in the same format as getData() */ + getGroupedData: (activeOnly?: boolean) => any; + /** You can retrieve the results of the column calculations at any point using the getCalcResults function.* For a table without grouped rows, this will return an object with top and bottom properties, that contain a row data object for all the columns in the table for the top calculations and bottom calculations respectively. + */ + getCalcResults: () => any; + /** Use the navigatePrev function to shift focus to the next editable cell on the left, if none available move to the right most editable cell on the row above. + * + * Note: These actions will only work when a cell is editable and has focus. + + Note: Navigation commands will only focus on editable cells, that is cells with an editor and if present an editable function that returns true. + * + */ + navigatePrev: () => void; + /** Use the navigateNext function to shift focus to the next editable cell on the right, if none available move to left most editable cell on the row below.* + * Note: These actions will only work when a cell is editable and has focus. + + Note: Navigation commands will only focus on editable cells, that is cells with an editor and if present an editable function that returns true. + * + */ + navigateNext: () => void; + /** Use the navigateLeft function to shift focus to next editable cell on the left, return false if none available on row.* + * Note: These actions will only work when a cell is editable and has focus. + + Note: Navigation commands will only focus on editable cells, that is cells with an editor and if present an editable function that returns true. + * + */ + navigateLeft: () => void; + /** Use the navigateRight function to shift focus to next editable cell on the right, return false if none available on row.* + * Note: These actions will only work when a cell is editable and has focus. + + Note: Navigation commands will only focus on editable cells, that is cells with an editor and if present an editable function that returns true. + * + */ + navigateRight: () => void; + /** Use the navigateUp function to shift focus to the same cell in the row above. + + * Note: These actions will only work when a cell is editable and has focus. + + Note: Navigation commands will only focus on editable cells, that is cells with an editor and if present an editable function that returns true. + * + */ + navigateUp: () => void; + + /*Use the navigateDown function to shift focus to the same cell in the row below. + + * Note: These actions will only work when a cell is editable and has focus. + + Note: Navigation commands will only focus on editable cells, that is cells with an editor and if present an editable function that returns true. + * + */ + navigateDown: () => void; + + /** A lot of the modules come with a range of default settings to make setting up your table easier, for example the sorters, formatters and editors that ship with Tabulator as standard. + + If you are using a lot of custom settings over and over again (for example a custom sorter). you can end up re-delcaring it several time for different tables. To make your life easier Tabulator allows you to extend the default setup of each module to make your custom options as easily accessible as the defaults. + + Using the extendModule function on the global Tabulator variable allows you to globally add these options to all tables. + + The function takes three arguments, the name of the module, the name of the property you want to extend, and an object containing the elements you want to add in your module. In the example below we extend the format module to add two new default formatters: */ + extendModule: (name: string, property: string, values: {}) => void; +} diff --git a/types/tabulator-tables/tabulator-tables-tests.ts b/types/tabulator-tables/tabulator-tables-tests.ts new file mode 100644 index 0000000000..3a33817b4f --- /dev/null +++ b/types/tabulator-tables/tabulator-tables-tests.ts @@ -0,0 +1,433 @@ +// tslint:disable:no-object-literal-type-assertion +// tslint:disable:whitespace + +// constructor +let table = new Tabulator("#test"); +table.copyToClipboard("selection"); +table.searchRows("name", "<", 3); +table.setFilter("name", "<=", 3); +table.setFilter([ + { field: "age", type: ">", value: 52 }, // filter by age greater than 52 + { field: "height", type: "<", value: 142 }, // and by height less than 142 + { field: "name", type: "in", value: ["steve", "bob", "jim"] } // name must be steve, bob or jim +]); +table.setFilter( + (data, filterParams) => { + // data - the data for the row being filtered + // filterParams - params object passed to the filter + return data.name === "bob" && data.height < filterParams.height; // must return a boolean, true if it passes the filter. + }, + { height: 3 } +); +table.setFilter("age", "in", ["steve", "bob", "jim"]); +table.setFilter([ + { field: "age", type: ">", value: 52 }, // filter by age greater than 52 + [ + { field: "height", type: "<", value: 142 }, // with a height of less than 142 + { field: "name", type: "=", value: "steve" } // or a name of steve + ] +]); + +table + .setPageToRow(12) + .then(() => { + // run code after table has been successfuly updated + }) + .catch(error => { + // handle error loading data + }); + +table.setGroupBy("gender"); +table.setGroupStartOpen(true); + +table.setGroupHeader((value, count, data, group) => { + return ""; +}); +table.setGroupHeader((value, count, data) => { + return ""; +}); + +table.setSort([ + { column: "age", dir: "asc" }, // sort by this first + { column: "height", dir: "desc" } // then sort by this second +]); + +table + .scrollToColumn("age", "middle", false) + .then(() => { + // run code after column has been scrolled to + }) + .catch(error => { + // handle error scrolling to column + }); + +table + .updateOrAddData([{ id: 1, name: "bob" }, { id: 3, name: "steve" }]) + .then(rows => { + // rows - array of the row components for the rows updated or added + // run code after data has been updated + }) + .catch(error => { + // handle error updating data + }); + +table.updateData([{ id: 1, name: "bob", gender: "male" }, { id: 2, name: "Jenny", gender: "female" }]); +table + .updateData([{ id: 1, name: "bob" }]) + .then(() => { + // run code after data has been updated + }) + .catch(error => { + // handle error updating data + }); + +let row1: Tabulator.RowComponent; +let row2: Tabulator.RowComponent; + +// column definitions +let colDef: Tabulator.ColumnDefinition = { title: "title" }; +colDef.sorter = customSorter; + +// prettier-ignore +function customSorter(a: any, b: any, aRow: Tabulator.RowComponent, + bRow: Tabulator.RowComponent, column: Tabulator.ColumnComponent, + dir: Tabulator.SortDirection, sorterParams: Tabulator.ColumnDefinitionSorterParams): number { + return 1; +} + +colDef.sorterParams = (col: Tabulator.ColumnComponent, dir: Tabulator.SortDirection) => { + return {}; +}; +colDef.sorterParams = { format: "DD/MM/YY" }; +colDef.formatterParams = { + invalidPlaceholder: val => { + return ""; + } +}; + +colDef.formatterParams = cell => { + // cell - the cell component + + // do some processing and return the param object + return { param1: "green" }; +}; + +// List lookup +colDef.formatterParams = { + small: "Cute", + medium: "Fine", + big: 2, + huge: true +}; +// Custom Formatter +colDef.formatter = (cell: Tabulator.CellComponent, formatterParams: {}, onRendered) => { + onRendered = () => {}; + return ""; +}; + +colDef.editor = true; +colDef.editor = "number"; +colDef.editor = (cell, onRendered, success, cancel, editorParams) => { + // cell - the cell component for the editable cell + // onRendered - function to call when the editor has been rendered + // success - function to call to pass the successfuly updated value to Tabulator + // cancel - function to call to abort the edit and return to a normal cell + // editorParams - params object passed into the editorParams column definition property + + // create and style editor + const editor = document.createElement("input"); + + editor.setAttribute("type", "date"); + + // create and style input + editor.style.padding = "3px"; + editor.style.width = "100%"; + editor.style.boxSizing = "border-box"; + + // Set value of editor to the current value of the cell + editor.value = moment(cell.getValue(), "DD/MM/YYYY"); + + // set focus on the select box when the editor is selected (timeout allows for editor to be added to DOM) + onRendered(() => { + editor.focus(); + editor.style.cssText = "100%"; + }); + + // when the value has been set, trigger the cell to update + function successFunc() { + success(moment(editor.value, "YYYY-MM-DD")); + } + + editor.addEventListener("change", successFunc); + editor.addEventListener("blur", successFunc); + + // return the editor element + return editor; +}; +// Dummy function +function moment(a: any, b: any) { + return ""; +} + +colDef.cellClick = (_e, cell) => { + console.log(cell.checkHeight); +}; + +colDef.formatterParams = { stars: 3 }; + +colDef.editorParams = {}; +colDef.editorParams = { + values: [ + { + // option group + label: "Men", + options: [ + // options in option group + { + label: "Steve Boberson", + value: "steve" + }, + { + label: "Bob Jimmerson", + value: "bob" + } + ] + }, + { + // option group + label: "Women", + options: [ + // options in option group + { + label: "Jenny Jillerson", + value: "jenny" + }, + { + label: "Jill Betterson", + value: "jill" + } + ] + }, + { + // ungrouped option + label: "Other", + value: "other" + } + ] +}; + +let selectParamValues: Tabulator.JSONRecord; +selectParamValues = { + steve: "Steve Boberson", + bob: "Bob Jimmerson", + jim: true +}; +colDef.editorParams = { + values: selectParamValues +}; + +colDef.editorParams = cell => { + return {}; +}; + +let autoComplete: Tabulator.AutoCompleteParams = { + showListOnEmpty: true, // show all values when the list is empty, + freetext: true, // allow the user to set the value of the cell to a free text entry + allowEmpty: true, // allow empty string values + searchFunc: (term, values) => { + // search for exact matches + const matches: string[] = []; + return matches; + }, + listItemFormatter: (value, title) => { + // prefix all titles with the work "Mr" + return "Mr " + title; + }, + values: true // create list of values from all values contained in this column +}; +colDef.editorParams = autoComplete; + +colDef.editorParams = { + values: [ + { + // option group + label: "Men", + options: [ + // options in option group + { + label: "Steve Boberson", + value: "steve" + }, + { + label: "Bob Jimmerson", + value: "bob" + } + ] + }, + { + // option group + label: "Women", + options: [ + // options in option group + { + label: "Jenny Jillerson", + value: "jenny" + }, + { + label: "Jill Betterson", + value: "jill" + } + ] + }, + { + // ungrouped option + label: "Other", + value: "other" + } + ] +}; + +// Validators +colDef.validator = { + type: (cell, value, parameters) => { + return true; + }, + parameters: { + divisor: 5 + } +}; +colDef.validator = "float"; +colDef.validator = { type: "float", parameters: {} }; + +let validators: Tabulator.Validator[] = [ + { type: "integer", parameters: {} }, + { + type: (cell, value, parameters) => { + return true; + }, + parameters: {} + } +]; + +colDef.headerFilterFunc = "!="; +colDef.headerFilterFunc = (headerValue, rowValue, rowData, filterParams) => { + return rowData.name === filterParams.name && rowValue < headerValue; // must return a boolean, true if it passes the filter. +}; + +// Cell Component + +let cell = {}; +cell.nav().down(); + +let data = cell.getData(); +table = cell.getTable(); + +// Row Component +let row = {}; +row.delete() + .then(() => { + // run code after row has been deleted + }) + .catch(error => { + // handle error deleting row + }); + +// Options +let options = {}; +options.keybindings = { + navPrev: "ctrl + 1", + navNext: false +}; + +options.downloadDataFormatter = data => { + // data.forEach(function(row){ + // row.age = row.age >= 18 ? "adult" : "child"; +}; + +options.downloadConfig = { + columnGroups: false, // include column groups in column headers for download + rowGroups: false, // do not include row groups in download + columnCalcs: false // do not include column calculation rows in download +}; + +options.ajaxConfig = "GET"; +options.ajaxConfig = { + mode: "cors", // set request mode to cors + credentials: "same-origin", // send cookies with the request from the matching origin + headers: { + Accept: "application/json", // tell the server we need JSON back + "X-Requested-With": "XMLHttpRequest", // fix to help some frameworks respond correctly to request + "Content-type": "application/json; charset=utf-8", // set the character encoding of the request + "Access-Control-Allow-Origin": "http:// yout-site.com" // the URL origin of the site making the request + } +}; +options.ajaxConfig = { + method: "POST", // set request type to Position + headers: { + "Content-type": "application/json; charset=utf-8" // set specific content type + } +}; + +options.ajaxContentType = { + headers: { + "Content-Type": "text/html" + }, + body: (url, config, params) => { + // url - the url of the request + // config - the fetch config object + // params - the request parameters + + // return comma list of params:values + const output = []; + + for (const key in params) { + output.push(`${key} ":" ${params[key]}`); + } + + return output.join(","); + } +}; + +options.initialSort = [{ column: "name", dir: "asc" }, { column: "name2", dir: "desc" }]; +options.initialFilter = [{ field: "color", type: "=", value: "red" }]; +options.initialHeaderFilter = [ + { field: "color", value: "red" } // set the initial value of the header filter to "red" +]; + +options.groupValues = [ + ["red", "blue", "green"], // create groups for color values of "red", "blue", and "green", + [10, 20, 30] // create sub groups for ages of 10, 20 and 30 +]; + +options.groupHeader = (value, count, data, group) => { + // value - the value all members of this group share + // count - the number of rows in this group + // data - an array of all the row data objects in this group + // group - the group component for the group + + return `${value} (${count}item)`; +}; + +options.groupHeader = [ + (value, count, data) => { + // generate header contents for gender groups + return `${value} (${count}item)`; + }, + (value, count, data) => { + // generate header contents for color groups + return `${value} (${count}item)`; + } +]; + +options.paginationDataReceived = { + last_page: "max_pages", + a: "b" +}; + +options.clipboardPasteParser = clipboard => { + return []; // return array +}; + +options.cellEditing = cell => { + console.log(cell); +}; diff --git a/types/tabulator-tables/tsconfig.json b/types/tabulator-tables/tsconfig.json new file mode 100644 index 0000000000..7f97e421b8 --- /dev/null +++ b/types/tabulator-tables/tsconfig.json @@ -0,0 +1,16 @@ +{ + "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", "tabulator-tables-tests.ts"] +} diff --git a/types/tabulator-tables/tslint.json b/types/tabulator-tables/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/tabulator-tables/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/tape-async/.editorconfig b/types/tape-async/.editorconfig new file mode 100644 index 0000000000..a0207fa43b --- /dev/null +++ b/types/tape-async/.editorconfig @@ -0,0 +1,3 @@ +# This package uses tabs +[*] +indent_style = tab diff --git a/types/tape-async/index.d.ts b/types/tape-async/index.d.ts new file mode 100644 index 0000000000..c3ce0801d6 --- /dev/null +++ b/types/tape-async/index.d.ts @@ -0,0 +1,69 @@ +// Type definitions for tape-async 2.3 +// Project: https://github.com/parro-it/tape-async +// Definitions by: ExE Boss +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +import tapeSync = require("tape"); +export = tape; + +declare function tape(name: string | tape.TestOptions, cb: tape.TestCase): void; +declare function tape(name: string, opts: tape.TestOptions, cb: tape.TestCase): void; +declare function tape(cb: tape.TestCase): void; + +declare namespace tape { + interface TestCase { + (test: Test): void | Iterator | PromiseLike; + } + + /** + * Available opts options for the tape function. + */ + type TestOptions = tapeSync.TestOptions; + + /** + * Options for the createStream function. + */ + type StreamOptions = tapeSync.StreamOptions; + + /** + * Generate a new test that will be skipped over. + */ + function skip(name: string | TestOptions, cb: TestCase): void; + function skip(name: string, opts: TestOptions, cb: TestCase): void; + function skip(cb: TestCase): void; + + /** + * The onFinish hook will get invoked when ALL tape tests have finished right before tape is about to print the test summary. + */ + function onFinish(cb: () => void): void; + + /** + * Like test(name?, opts?, cb) except if you use .only this is the only test case that will run for the entire process, all other test cases using tape will be ignored. + */ + function only(name: string | TestOptions, cb: TestCase): void; + function only(name: string, opts: TestOptions, cb: TestCase): void; + function only(cb: TestCase): void; + + /** + * Create a new test harness instance, which is a function like test(), but with a new pending stack and test state. + */ + function createHarness(): typeof tape; + /** + * Create a stream of output, bypassing the default output stream that writes messages to console.log(). + * By default stream will be a text stream of TAP output, but you can get an object stream instead by setting opts.objectMode to true. + */ + function createStream(opts?: StreamOptions): NodeJS.ReadableStream; + + interface Test extends tapeSync.Test { + /** + * Create a subtest with a new test handle st from cb(st) inside the current test. + * cb(st) will only fire when t finishes. + * Additional tests queued up after t will not be run until all subtests finish. + */ + test(name: string, cb: TestCase): void; + test(name: string, opts: TestOptions, cb: TestCase): void; + } +} diff --git a/types/tape-async/test/tape-async.async.test.ts b/types/tape-async/test/tape-async.async.test.ts new file mode 100644 index 0000000000..64b740de28 --- /dev/null +++ b/types/tape-async/test/tape-async.async.test.ts @@ -0,0 +1,35 @@ +import tape = require("tape-async"); + +const name: string = undefined; +const cb = async (test: tape.Test) => {}; +const opts: tape.TestOptions = {}; +let t: tape.Test; + +tape(cb); +tape(name, cb); +tape(opts, cb); +tape(name, opts, cb); + +tape(name, async (test: tape.Test) => { + t = test; +}); + +tape.skip(cb); +tape.skip(name, cb); +tape.skip(opts, cb); +tape.skip(name, opts, cb); + +tape.only(cb); +tape.only(name, cb); +tape.only(opts, cb); +tape.only(name, opts, cb); + +tape(name, async (test: tape.Test) => { + test.test(name, async (st) => { + t = st; + }); + + test.test(name, opts, async (st) => { + t = st; + }); +}); diff --git a/types/tape-async/test/tape-async.generators.test.ts b/types/tape-async/test/tape-async.generators.test.ts new file mode 100644 index 0000000000..7b6cc09eb4 --- /dev/null +++ b/types/tape-async/test/tape-async.generators.test.ts @@ -0,0 +1,35 @@ +import tape = require("tape-async"); + +const name: string = undefined; +const cb = function*(test: tape.Test): IterableIterator {}; +const opts: tape.TestOptions = {}; +let t: tape.Test; + +tape(cb); +tape(name, cb); +tape(opts, cb); +tape(name, opts, cb); + +tape(name, function*(test: tape.Test): IterableIterator { + t = test; +}); + +tape.skip(cb); +tape.skip(name, cb); +tape.skip(opts, cb); +tape.skip(name, opts, cb); + +tape.only(cb); +tape.only(name, cb); +tape.only(opts, cb); +tape.only(name, opts, cb); + +tape(name, function*(test: tape.Test): IterableIterator { + test.test(name, function*(st: tape.Test): IterableIterator { + t = st; + }); + + test.test(name, opts, function*(st: tape.Test): IterableIterator { + t = st; + }); +}); diff --git a/types/tape-async/test/tape-async.test.ts b/types/tape-async/test/tape-async.test.ts new file mode 100644 index 0000000000..c2ed921938 --- /dev/null +++ b/types/tape-async/test/tape-async.test.ts @@ -0,0 +1,178 @@ +import tape = require("tape-async"); + +const name: string = undefined; +const cb = (test: tape.Test) => {}; +const opts: tape.TestOptions = {}; +let t: tape.Test; + +tape(cb); +tape(name, cb); +tape(opts, cb); +tape(name, opts, cb); + +tape(name, (test: tape.Test) => { + t = test; +}); + +tape.skip(cb); +tape.skip(name, cb); +tape.skip(opts, cb); +tape.skip(name, opts, cb); + +tape.only(cb); +tape.only(name, cb); +tape.only(opts, cb); +tape.only(name, opts, cb); + +tape.onFinish(() => {}); + +const sopts: tape.StreamOptions = undefined; +let rs: NodeJS.ReadableStream; +rs = tape.createStream(); +rs = tape.createStream(sopts); + +let htest: typeof tape; +htest = tape.createHarness(); + +class CustomException extends Error { + constructor(message?: string) { + super(message); + } +} + +tape(name, (test: tape.Test) => { + const num: number = undefined; + const ms: number = undefined; + const value: any = undefined; + const actual: any = undefined; + const expected: any = undefined; + const err: any = undefined; + const fn = () => {}; + const msg: string = undefined; + + const exceptionExpected: RegExp | (() => void) = undefined; + + test.plan(num); + test.end(); + test.end(err); + + test.fail(msg); + test.pass(msg); + test.timeoutAfter(ms); + test.skip(msg); + + test.ok(value); + test.ok(value, msg); + test.true(value); + test.true(value, msg); + test.assert(value); + test.assert(value, msg); + + test.notOk(value); + test.notOk(value, msg); + test.false(value); + test.false(value, msg); + test.notok(value); + test.notok(value, msg); + + test.error(err, msg); + test.ifError(err, msg); + test.ifErr(err, msg); + test.iferror(err, msg); + + test.equal(actual, expected); + test.equal(actual, expected, msg); + test.equals(actual, expected); + test.equals(actual, expected, msg); + test.isEqual(actual, expected); + test.isEqual(actual, expected, msg); + test.is(actual, expected); + test.is(actual, expected, msg); + test.strictEqual(actual, expected); + test.strictEqual(actual, expected, msg); + test.strictEquals(actual, expected); + test.strictEquals(actual, expected, msg); + + test.notEqual(actual, expected); + test.notEqual(actual, expected, msg); + test.notEquals(actual, expected); + test.notEquals(actual, expected, msg); + test.notStrictEqual(actual, expected); + test.notStrictEqual(actual, expected, msg); + test.notStrictEquals(actual, expected); + test.notStrictEquals(actual, expected, msg); + test.isNotEqual(actual, expected); + test.isNotEqual(actual, expected, msg); + test.isNot(actual, expected); + test.isNot(actual, expected, msg); + test.not(actual, expected); + test.not(actual, expected, msg); + test.doesNotEqual(actual, expected); + test.doesNotEqual(actual, expected, msg); + test.isInequal(actual, expected); + test.isInequal(actual, expected, msg); + + test.deepEqual(actual, expected); + test.deepEqual(actual, expected, msg); + test.deepEquals(actual, expected); + test.deepEquals(actual, expected, msg); + test.isEquivalent(actual, expected); + test.isEquivalent(actual, expected, msg); + test.same(actual, expected); + test.same(actual, expected, msg); + + test.notDeepEqual(actual, expected); + test.notDeepEqual(actual, expected, msg); + test.notEquivalent(actual, expected); + test.notEquivalent(actual, expected, msg); + test.notDeeply(actual, expected); + test.notDeeply(actual, expected, msg); + test.notSame(actual, expected); + test.notSame(actual, expected, msg); + test.isNotDeepEqual(actual, expected); + test.isNotDeepEqual(actual, expected, msg); + test.isNotDeeply(actual, expected); + test.isNotDeeply(actual, expected, msg); + test.isNotEquivalent(actual, expected); + test.isNotEquivalent(actual, expected, msg); + test.isInequivalent(actual, expected); + test.isInequivalent(actual, expected, msg); + + test.deepLooseEqual(actual, expected); + test.deepLooseEqual(actual, expected, msg); + test.looseEqual(actual, expected); + test.looseEqual(actual, expected, msg); + test.looseEquals(actual, expected); + test.looseEquals(actual, expected, msg); + + test.notDeepLooseEqual(actual, expected); + test.notDeepLooseEqual(actual, expected, msg); + test.notLooseEqual(actual, expected); + test.notLooseEqual(actual, expected, msg); + test.notLooseEquals(actual, expected); + test.notLooseEquals(actual, expected, msg); + + test.throws(fn); + test.throws(fn, msg); + test.throws(fn, exceptionExpected); + test.throws(fn, exceptionExpected, msg); + test.throws(fn, CustomException); + test.throws(fn, CustomException, msg); + + test.doesNotThrow(fn); + test.doesNotThrow(fn, msg); + test.doesNotThrow(fn, exceptionExpected); + test.doesNotThrow(fn, exceptionExpected, msg); + test.doesNotThrow(fn, CustomException); + test.doesNotThrow(fn, CustomException, msg); + + test.test(name, st => { + t = st; + }); + + test.test(name, opts, st => { + t = st; + }); + + test.comment(msg); +}); diff --git a/types/tape-async/tsconfig.json b/types/tape-async/tsconfig.json new file mode 100644 index 0000000000..c5b3e90053 --- /dev/null +++ b/types/tape-async/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "test/tape-async.async.test.ts", + "test/tape-async.generators.test.ts", + "test/tape-async.test.ts" + ] +} diff --git a/types/tape-async/tslint.json b/types/tape-async/tslint.json new file mode 100644 index 0000000000..a541931a86 --- /dev/null +++ b/types/tape-async/tslint.json @@ -0,0 +1,9 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "indent": [ + true, + "tabs" + ] + } +} diff --git a/types/tinymce/index.d.ts b/types/tinymce/index.d.ts index e50feb0b5d..eba9bc29bf 100644 --- a/types/tinymce/index.d.ts +++ b/types/tinymce/index.d.ts @@ -394,7 +394,7 @@ export class Editor extends util.Observable { addCommand(name: string, callback: (ui: boolean, value: {}) => boolean, scope?: {}): void; - addContextToolbar(predicate: () => boolean, items: string): void; + addContextToolbar(predicate: ((el: Node) => boolean) | string, items: string): void; addMenuItem(name: string, settings: {}): void; diff --git a/types/tmi.js/index.d.ts b/types/tmi.js/index.d.ts index 86076ce202..0363842148 100644 --- a/types/tmi.js/index.d.ts +++ b/types/tmi.js/index.d.ts @@ -1,11 +1,11 @@ -// Type definitions for tmi.js 1.3 +// Type definitions for tmi.js 1.4 // Project: https://github.com/tmijs/tmi.js // Definitions by: William Papsco // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 3.3 // Twitch IRC docs: https://dev.twitch.tv/docs/irc/ -// Last updated: 2019/2/27 +// Last updated: 2019/3/06 import { StrictEventEmitter } from "./strict-event-emitter-types"; @@ -16,6 +16,7 @@ export interface Actions { color(color: string): Promise<[string]>; commercial(channel: string, seconds: number): Promise<[string, number]>; connect(): Promise<[string, number]>; + deletemessage(channel: string, messageUUID: string): Promise<[string]>; disconnect(): Promise<[string, number]>; emoteonly(channel: string): Promise<[string]>; emoteonlyoff(channel: string): Promise<[string]>; @@ -39,11 +40,15 @@ export interface Actions { unban(channel: string, username: string): Promise<[string, string]>; unhost(channel: string): Promise<[string]>; unmod(channel: string, username: string): Promise<[string, string]>; + unvip(channel: string, username: string): Promise<[string, string]>; + vip(channel: string, username: string): Promise<[string, string]>; + vips(channel: string): Promise; whisper(username: string, message: string): Promise<[string, string]>; } export interface Events { action(channel: string, userstate: ChatUserstate, message: string, self: boolean): void; + anongiftpaidupgrade(channel: string, username: string, userstate: AnonSubGiftUpgradeUserstate): void; ban(channel: string, username: string, reason: string): void; chat(channel: string, userstate: ChatUserstate, message: string, self: boolean): void; cheer(channel: string, userstate: ChatUserstate, message: string): void; @@ -54,11 +59,13 @@ export interface Events { emoteonly(channel: string, enabled: boolean): void; emotesets(sets: string, obj: EmoteObj): void; followersonly(channel: string, enabled: boolean, length: number): void; + giftpaidupgrade(channel: string, username: string, sender: string, userstate: SubGiftUpgradeUserstate): void; hosted(channel: string, username: string, viewers: number, autohost: boolean): void; hosting(channel: string, target: string, viewers: number): void; join(channel: string, username: string, self: boolean): void; logon(): void; message(channel: string, userstate: ChatUserstate, message: string, self: boolean): void; + messagedeleted(channel: string, username: string, deletedMessage: string, userstate: DeleteUserstate): void; mod(channel: string, username: string): void; mods(channel: string, mods: string[]): void; notice(channel: string, msgid: MsgID, message: string): void; @@ -66,16 +73,21 @@ export interface Events { ping(): void; pong(latency: number): void; r9kbeta(channel: string, enabled: boolean): void; + raided(channel: string, username: string, viewers: number): void; + "raw_message": (messageCloned: { [property: string]: any }, message: { [property: string]: any }) => void; reconnect(): void; - resub(channel: string, username: string, months: number, message: string, userstate: SubUserstate, methods: ResubMethod): void; + resub(channel: string, username: string, months: number, message: string, userstate: SubUserstate, methods: SubMethods): void; roomstate(channel: string, state: RoomState): void; serverchange(channel: string): void; slowmode(channel: string, enabled: boolean, length: number): void; + subgift(channel: string, username: string, streakMonths: number, recipient: string, methods: SubMethods, userstate: SubGiftUserstate): void; + submysterygift(channel: string, username: string, numbOfSubs: number, methods: SubMethods, userstate: SubMysteryGiftUserstate): void; subscribers(channel: string, enabled: boolean): void; - subscription(channel: string, username: string, method: ResubMethod, message: string, userstate: SubUserstate): void; + subscription(channel: string, username: string, methods: SubMethods, message: string, userstate: SubUserstate): void; timeout(channel: string, username: string, reason: string, duration: number): void; unhost(channel: string, viewers: number): void; unmod(channel: string, username: string): void; + vips(channel: string, vips: string[]): void; whisper(from: string, userstate: ChatUserstate, message: string, self: boolean): void; } @@ -108,6 +120,18 @@ export interface Badges { premium?: string; } +export interface SubMethods { + prime?: boolean; + plan?: SubMethod; + planName?: string; +} + +export interface DeleteUserstate { + login?: string; + message?: string; + "target-msg-id"?: string; +} + export interface CommonUserstate { badges?: Badges; color?: string; @@ -124,6 +148,7 @@ export interface CommonUserstate { "user-id"?: string; "tmi-sent-ts"?: string; flags?: string; + [paramater: string]: any; } export interface UserNoticeState extends CommonUserstate { @@ -133,10 +158,17 @@ export interface UserNoticeState extends CommonUserstate { } export interface CommonSubUserstate extends UserNoticeState { - "msg-param-sub-plan"?: ResubMethod; + "msg-param-sub-plan"?: SubMethod; "msg-param-sub-plan-name"?: string; } +export interface CommonGiftSubUserstate extends CommonSubUserstate { + "msg-param-recipient-display-name"?: string; + "msg-param-recipient-id"?: string; + "msg-param-recipient-user-name"?: string; + "msg-param-months"?: boolean | string; +} + export interface ChatUserstate extends CommonUserstate { 'message-type'?: "chat" | "action" | "whisper"; username?: string; @@ -150,11 +182,28 @@ export interface SubUserstate extends CommonSubUserstate { "msg-param-streak-months"?: string | boolean; } -export interface SubGiftUserstate extends CommonSubUserstate { - 'message-type'?: "subgift" | "anonsubgift"; - "msg-param-recipient-display-name"?: string; - "msg-param-recipient-id"?: string; - "msg-param-recipient-user-name"?: string; +export interface SubMysteryGiftUserstate extends CommonSubUserstate { + 'message-type'?: "submysterygift"; + "msg-param-sender-count"?: string | boolean; +} + +export interface SubGiftUserstate extends CommonGiftSubUserstate { + 'message-type'?: "subgift"; + "msg-param-sender-count"?: string | boolean; +} + +export interface AnonSubGiftUserstate extends CommonGiftSubUserstate { + "message-type"?: "anonsubgift"; +} + +export interface SubGiftUpgradeUserstate extends CommonSubUserstate { + "message-type"?: "giftpaidupgrade"; + "msg-param-sender-name"?: string; + "msg-param-sender-login"?: string; +} + +export interface AnonSubGiftUpgradeUserstate extends CommonSubUserstate { + "message-type"?: "anongiftpaidupgrade"; } export interface RaidUserstate extends UserNoticeState { @@ -169,7 +218,15 @@ export interface RitualUserstate extends UserNoticeState { "msg-param-ritual-name"?: "new_chatter"; } -export type Userstate = ChatUserstate | SubGiftUserstate | SubUserstate | RaidUserstate | RitualUserstate; +export type Userstate = ChatUserstate | + SubUserstate | + SubGiftUserstate | + SubGiftUpgradeUserstate | + AnonSubGiftUserstate | + SubMysteryGiftUserstate | + AnonSubGiftUpgradeUserstate | + RaidUserstate | + RitualUserstate; export interface EmoteObj { [id: string]: [{ @@ -251,7 +308,7 @@ export type MsgID = "already_banned" | "whisper_limit_per_sec" | "whisper_restricted_recipient"; -export type ResubMethod = "Prime" | "1000" | "2000" | "3000"; +export type SubMethod = "Prime" | "1000" | "2000" | "3000"; export interface RoomState { "broadcaster-lang"?: string; diff --git a/types/tmi.js/tmi.js-tests.ts b/types/tmi.js/tmi.js-tests.ts index 6cd2c62629..28a380088b 100644 --- a/types/tmi.js/tmi.js-tests.ts +++ b/types/tmi.js/tmi.js-tests.ts @@ -30,7 +30,7 @@ const options: tmi.Options = { const client: tmi.Client = tmi.Client(options); client.connect().then(() => { - client.on("subscription", (channel: string, username: string, method: tmi.ResubMethod, msg: string, userstate: tmi.SubUserstate) => { + client.on("subscription", (channel: string, username: string, methods: tmi.SubMethods, msg: string, userstate: tmi.SubUserstate) => { client.say(channel, `Thank you to ${userstate["display-name"]} for subscribing!`); client.ping(); client.r9kbeta(channel); @@ -56,7 +56,7 @@ client.connect().then(() => { client.unmod(channel, username); client.whisper(username, "whisper"); client.part(channel); - switch (method) { + switch (methods.plan) { case "1000": case "2000": case "3000": diff --git a/types/trim-newlines/index.d.ts b/types/trim-newlines/index.d.ts new file mode 100644 index 0000000000..7abe323fe2 --- /dev/null +++ b/types/trim-newlines/index.d.ts @@ -0,0 +1,13 @@ +// Type definitions for trim-newlines 2.0 +// Project: https://github.com/sindresorhus/trim-newlines#readme +// Definitions by: Daniel Cassidy +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function trimNewlines(input: string): string; + +declare namespace trimNewlines { + function start(input: string): string; + function end(input: string): string; +} + +export = trimNewlines; diff --git a/types/trim-newlines/trim-newlines-tests.ts b/types/trim-newlines/trim-newlines-tests.ts new file mode 100644 index 0000000000..e3bc17661a --- /dev/null +++ b/types/trim-newlines/trim-newlines-tests.ts @@ -0,0 +1,10 @@ +import trimNewlines = require("trim-newlines"); + +// $ExpectType string +trimNewlines('\nunicorn\r\n'); + +// $ExpectType string +trimNewlines.start("\n\npony\n"); + +// $ExpectType string +trimNewlines.end("\ndonk\n\n"); diff --git a/types/trim-newlines/tsconfig.json b/types/trim-newlines/tsconfig.json new file mode 100644 index 0000000000..8dbcfef306 --- /dev/null +++ b/types/trim-newlines/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", + "trim-newlines-tests.ts" + ] +} diff --git a/types/trim-newlines/tslint.json b/types/trim-newlines/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/trim-newlines/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/unsplash-js/index.d.ts b/types/unsplash-js/index.d.ts new file mode 100644 index 0000000000..8eb6222778 --- /dev/null +++ b/types/unsplash-js/index.d.ts @@ -0,0 +1,243 @@ +// Type definitions for unsplash-js 5.0 +// Project: https://github.com/unsplash/unsplash-js#readme +// Definitions by: Andrew Malikov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +export default class Unsplash { + auth: UnsplashApi.Auth; + categories: UnsplashApi.Categories; + collections: UnsplashApi.Collections; + currentUser: UnsplashApi.CurrentUser; + users: UnsplashApi.Users; + photos: UnsplashApi.Photo; + search: UnsplashApi.Search; + stats: UnsplashApi.Stats; + + constructor(options: { + apiUrl?: string; + apiVersion?: string; + applicationId: string; + secret: string; + callbackUrl?: string; + bearerToken?: string; + headers?: { [key: string]: string }; + }); + + request(requestOptions: { + url: string; + method: string; + query: object; + headers: object; + body: object; + oauth: boolean; + }): Promise; +} + +export function toJson(response: any): any; + +export namespace UnsplashApi { + interface Photo { + listPhotos( + page?: number, + perPage?: number, + orderBy?: string + ): Promise; + + listCuratedPhotos( + page?: number, + perPage?: number, + orderBy?: string + ): Promise; + + searchPhotos( + query: string, + categories: ReadonlyArray, + page: number, + perPage: number + ): Promise; + + getPhoto( + id: string, + width?: number, + height?: number, + rectangle?: ReadonlyArray + ): Promise; + + getPhotoStats(id: string): Promise; + + getRandomPhoto(options: { + width?: number; + height?: number; + query?: string; + username?: string; + featured?: boolean; + collections?: ReadonlyArray; + count?: number; + }): Promise; + + uploadPhoto(photo: object): void; + + likePhoto(id: string): Promise; + + unlikePhoto(id: string): Promise; + + downloadPhoto(photo: { + links: { download_location: string }; + }): Promise; + } + + interface Collections { + listCollections( + page?: number, + perPage?: number, + orderBy?: string + ): Promise; + + listCuratedCollections( + page?: number, + perPage?: number + ): Promise; + + listFeaturedCollections( + page?: number, + perPage?: number + ): Promise; + + getCollection(id: number): Promise; + + getCollectionPhotos( + id: number, + page?: number, + perPage?: number, + orderBy?: string + ): Promise; + + getCuratedCollectionPhotos( + id: number, + page?: number, + perPage?: number, + orderBy?: string + ): Promise; + + createCollection( + title: string, + description?: string, + private?: boolean + ): Promise; + + updateCollection( + id: number, + title?: string, + description?: string, + private?: boolean + ): Promise; + + deleteCollection(id: number): Promise; + + addPhotoToCollection( + collectionId: number, + photoId: string + ): Promise; + + removePhotoFromCollection( + collectionId: number, + photoId: string + ): Promise; + + listRelatedCollections(collectionId: number): Promise; + } + + interface Search { + all(keyword: string, page: number, per_page: number): Promise; + + photos( + keyword: string, + page?: number, + per_page?: number + ): Promise; + + users( + keyword: string, + page?: number, + per_page?: number + ): Promise; + + collections( + keyword: string, + page?: number, + per_page?: number + ): Promise; + } + + interface Stats { + total(): Promise; + } + + interface CurrentUser { + profile(): Promise; + + updateProfile(options: { + username?: string; + firstName?: string; + lastName?: string; + email?: string; + url?: string; + location?: string; + bio?: string; + instagramUsername?: string; + }): Promise; + } + + interface Users { + profile(username: string): Promise; + + statistics( + username: string, + resolution?: string, + quantity?: number + ): Promise; + + photos( + username: string, + page?: number, + perPage?: number, + orderBy?: string, + stats?: boolean + ): Promise; + + likes( + username: string, + page?: number, + perPage?: number, + orderBy?: string + ): Promise; + + collections( + username: string, + page?: number, + perPage?: number, + orderBy?: string + ): Promise; + } + + interface Categories { + listCategories(): Promise; + + category(id: any): Promise; + + categoryPhotos( + id: any, + page?: number, + perPage?: number + ): Promise; + } + + interface Auth { + getAuthenticationUrl(scopes?: ReadonlyArray): string; + + userAuthentication(code: string): Promise; + + setBearerToken(accessToken: string): void; + } +} diff --git a/types/chai-http/tsconfig.json b/types/unsplash-js/tsconfig.json similarity index 86% rename from types/chai-http/tsconfig.json rename to types/unsplash-js/tsconfig.json index 45d92cf188..8d04d7480f 100644 --- a/types/chai-http/tsconfig.json +++ b/types/unsplash-js/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ @@ -19,6 +19,6 @@ }, "files": [ "index.d.ts", - "chai-http-tests.ts" + "unsplash-js-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/unsplash-js/tslint.json b/types/unsplash-js/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/unsplash-js/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/unsplash-js/unsplash-js-tests.ts b/types/unsplash-js/unsplash-js-tests.ts new file mode 100644 index 0000000000..262d4c5e02 --- /dev/null +++ b/types/unsplash-js/unsplash-js-tests.ts @@ -0,0 +1,100 @@ +import Unsplash, { toJson } from "unsplash-js"; + +const unsplash = new Unsplash({ + applicationId: "{APP_ACCESS_KEY}", + secret: "{APP_SECRET}" +}); + +const authenticationUrl = unsplash.auth.getAuthenticationUrl([ + "public", + "read_user", + "write_user", + "read_photos", + "write_photos" +]); + +unsplash.auth + .userAuthentication("{OAUTH_CODE}") + .then(toJson) + .then(json => { + unsplash.auth.setBearerToken(json.access_token); + }); + +unsplash.currentUser.profile(); + +unsplash.currentUser.updateProfile({ + username: "drizzy", + firstName: "Aubrey", + lastName: "Graham", + email: "drizzy@octobersveryown.com", + url: "http://octobersveryown.com", + location: "Toronto, Ontario, Canada", + bio: "Views from the 6", + instagramUsername: "champagnepapi" +}); + +unsplash.users.profile("naoufal"); + +unsplash.users.statistics("naoufal", "days", 30); + +unsplash.users.photos("naoufal", 1, 10, "popular", false); + +unsplash.users.likes("naoufal", 2, 15, "popular"); + +unsplash.users.collections("naoufal", 2, 15, "updated"); + +unsplash.photos.listPhotos(2, 15, "latest"); + +unsplash.photos.getPhoto("mtNweauBsMQ", 1920, 1080, [0, 0, 1920, 1080]); + +unsplash.photos.getPhotoStats("mtNweauBsMQ"); + +unsplash.photos.getRandomPhoto({ username: "naoufal" }); + +unsplash.photos.likePhoto("mtNweauBsMQ"); + +unsplash.photos.unlikePhoto("mtNweauBsMQ"); + +unsplash.photos + .getPhoto("mtNweauBsMQ") + .then(toJson) + .then(json => { + unsplash.photos.downloadPhoto(json); + }); + +unsplash.collections.listCollections(1, 10, "popular"); + +unsplash.collections.listFeaturedCollections(1, 10); + +unsplash.collections.getCollection(123456); + +unsplash.collections.getCollectionPhotos(123456, 1, 10, "popular"); + +unsplash.collections.createCollection( + "Birds", + "Wild birds from 'round the world", + true +); + +unsplash.collections.updateCollection( + 12345, + "Wild Birds", + "Wild birds from around the world", + false +); + +unsplash.collections.deleteCollection(42); + +unsplash.collections.addPhotoToCollection(88, "abc1234"); + +unsplash.collections.removePhotoFromCollection(88, "abc1234"); + +unsplash.collections.listRelatedCollections(88); + +unsplash.search.photos("dogs", 1); + +unsplash.search.users("steve", 1); + +unsplash.search.collections("dogs", 1); + +unsplash.stats.total(); diff --git a/types/urlencode/index.d.ts b/types/urlencode/index.d.ts index 451626cb79..a32e7bea25 100644 --- a/types/urlencode/index.d.ts +++ b/types/urlencode/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for urlencode 1.1 // Project: https://github.com/node-modules/urlencode -// Definitions by: My Self +// Definitions by: kimcoder // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface charsetParam { diff --git a/types/victory/index.d.ts b/types/victory/index.d.ts index 549e3823da..4fc95db8f1 100644 --- a/types/victory/index.d.ts +++ b/types/victory/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Alexey Svetliakov // snerks // Krzysztof Cebula -// Vitaliy Polyanskiy +// Vitaliy Polyanskiy // James Lismore // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -16,7 +16,7 @@ declare module "victory" { /** * Single animation object to interpolate */ - export type AnimationStyle = { [key: string ]: string | number }; + export type AnimationStyle = { [key: string]: string | number }; /** * Animation styles to interpolate @@ -32,6 +32,20 @@ declare module "victory" { "expIn" | "expOut" | "expInOut" | "poly" | "polyIn" | "polyOut" | "polyInOut" | "quad" | "quadIn" | "quadOut" | "quadInOut" | "sin" | "sinIn" | "sinOut" | "sinInOut"; + /** + * @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html + */ + type Omit = Pick>; + + type BlockProps = { + top?: number; + bottom?: number; + left?: number; + right?: number; + }; + + type PaddingProps = number | BlockProps; + // Many victory components accept string or number or callback which returns string or number type StringOrNumberOrCallback = | string @@ -44,9 +58,9 @@ declare module "victory" { * Style interface used in components/themeing */ export interface VictoryStyleInterface { - parent?: VictoryStyleObject; - data?: VictoryStyleObject; - labels?: VictoryStyleObject; + parent?: VictoryStyleObject; + data?: VictoryStyleObject; + labels?: VictoryStyleObject; } export interface VictoryAnimationProps { @@ -420,6 +434,81 @@ declare module "victory" { export class VictoryBrushContainer extends React.Component {} + export interface VictoryVoronoiContainerProps extends VictoryContainerProps { + /** + * When the activateData prop is set to true, the active prop will be set to true on all + * data components within a voronoi area. When this prop is set to false, the onActivated + * and onDeactivated callbacks will still fire, but no mutations to data components will + * occur via Victory’s event system. + */ + activateData?: boolean; + /** + * When the activateLabels prop is set to true, the active prop will be set to true on all + * labels corresponding to points within a voronoi area. When this prop is set to false, + * the onActivated and onDeactivated callbacks will still fire, but no mutations to label + * components will occur via Victory’s event system. Labels defined directly on + * VictoryVoronoiContainer via the labels prop will still appear when this prop is set to false. + */ + activateLabels?: boolean; + /** + * When the disable prop is set to true, VictoryVoronoiContainer events will not fire. + */ + disable?: boolean; + /** + * When a labels prop is provided to VictoryVoronoiContainer it will render a label component + * rather than activating labels on the child components it renders. This is useful for + * creating multi- point tooltips. This prop should be given as a function which will be called + * once for each active point. The labels function will be called with the arguments point, + * index, and points, where point refers to a single active point, index refers to the position + * of that point in the array of active points, and points is an array of all active points. + */ + labels?: (point: any, index: number, points: any[]) => string; + /** + * The labelComponent prop specified the component that will be rendered when labels are defined + * on VictoryVoronoiContainer. If the labels prop is omitted, no label component will be rendered. + */ + labelComponent?: React.ReactElement; + /** + * The onActivated prop accepts a function to be called whenever new data points are activated. + * The function is called with the parameters points (an array of active data objects) and props + * (the props used by VictoryVoronoiContainer). + */ + onActivated?: (points: any[], props: VictoryVoronoiContainerProps) => void; + /** + * The onDeactivated prop accepts a function to be called whenever points are deactivated. The + * function is called with the parameters points (an array of the newly-deactivated data objects) + * and props (the props used by VictoryVoronoiContainer). + */ + onDeactivated?: (points: any[], props: VictoryVoronoiContainerProps) => void; + /** + * When the radius prop is set, the voronoi areas associated with each data point will be no larger + * than the given radius. This prop should be given as a number. + */ + radius?: number; + /** + * The voronoiBlacklist prop is used to specify a list of components to ignore when calculating a + * shared voronoi diagram. Components with a name prop matching an element in the voronoiBlacklist + * array will be ignored by VictoryVoronoiContainer. Ignored components will never be flagged as + * active, and will not contribute date to shared tooltips or labels. + */ + voronoiBlacklist?: string[]; + /** + * When the voronoiDimension prop is set, voronoi selection will only take the given dimension into + * account. For example, when dimension is set to “x”, all data points matching a particular x mouse + * position will be activated regardless of y value. When this prop is not given, voronoi selection + * is determined by both x any y values. + */ + voronoiDimension?: "x" | "y"; + /** + * When the voronoiPadding prop is given, the area of the chart that will trigger voronoi events is + * reduced by the given padding on every side. By default, no padding is applied, and the entire range + * of a given chart may trigger voronoi events. This prop should be given as a number. + */ + voronoiPadding?: number; + } + + export class VictoryVoronoiContainer extends React.Component { } + export interface VictoryZoomContainerProps extends VictoryContainerProps { /** * The optional allowPan prop accepts a boolean that enables the panning @@ -774,8 +863,10 @@ declare module "victory" { */ eventHandlers: { [key: string]: { - (event: React.SyntheticEvent): EventCallbackInterface } | - { (event: React.SyntheticEvent): EventCallbackInterface[] + (event: React.SyntheticEvent): EventCallbackInterface + } | + { + (event: React.SyntheticEvent): EventCallbackInterface[] } }; } @@ -791,8 +882,8 @@ declare module "victory" { * Domain padding */ type DomainPaddingPropType = number | { - x?: number | [ number, number]; - y?: number | [ number, number]; + x?: number | [number, number]; + y?: number | [number, number]; }; /** @@ -858,12 +949,7 @@ declare module "victory" { * and right. * @default 50 */ - padding?: number | { - top?: number; - bottom?: number; - left?: number; - right?: number; - }; + padding?: PaddingProps; /** * The scale prop determines which scales your chart should use. This prop can be * given as a string specifying a supported scale ("linear", "time", "log", "sqrt"), @@ -1030,66 +1116,66 @@ declare module "victory" { } export interface VictoryAreaProps - extends VictoryCommonProps, - VictoryDatableProps, - VictorySingleLabableProps { - /** - * The event prop take an array of event objects. Event objects are composed of - * a target, an eventKey, and eventHandlers. Targets may be any valid style namespace - * for a given component, so "data" and "labels" are all valid targets for VictoryArea events. - * Since VictoryArea only renders a single element, the eventKey property is not used. - * The eventHandlers object should be given as an object whose keys are standard - * event names (i.e. onClick) and whose values are event callbacks. The return value - * of an event handler is used to modify elemnts. The return value should be given - * as an object or an array of objects with optional target and eventKey keys, - * and a mutation key whose value is a function. The target and eventKey keys - * will default to those corresponding to the element the event handler was attached to. - * The mutation function will be called with the calculated props for the individual selected - * element (i.e. an area), and the object returned from the mutation function - * will override the props of the selected element via object assignment. - * @example - * events={[ - * { - * target: "data", - * eventHandlers: { - * onClick: () => { - * return [ - * { - * mutation: (props) => { - * return {style: merge({}, props.style, {fill: "orange"})}; - * } - * }, { - * target: "labels", - * mutation: () => { - * return {text: "hey"}; - * } - * } - * ]; - * } - * } - * } - * ]} - */ - events?: EventPropTypeInterface<"data" | "labels" | "parent", "all">[]; - /** - * The interpolation prop determines how data points should be connected when plotting a line - * @default "linear" - */ - interpolation?: InterpolationPropType; - /** - * The samples prop specifies how many individual points to plot when plotting - * y as a function of x. Samples is ignored if x props are provided instead. - * @default 50 - */ - samples?: number; - /** - * The style prop specifies styles for your VictoryArea. Any valid inline style properties - * will be applied. Height, width, and padding should be specified via the height, - * width, and padding props, as they are used to calculate the alignment of - * components within chart. - * @example {data: {fill: "red"}, labels: {fontSize: 12}} - */ - style?: VictoryStyleInterface; + extends VictoryCommonProps, + VictoryDatableProps, + VictorySingleLabableProps { + /** + * The event prop take an array of event objects. Event objects are composed of + * a target, an eventKey, and eventHandlers. Targets may be any valid style namespace + * for a given component, so "data" and "labels" are all valid targets for VictoryArea events. + * Since VictoryArea only renders a single element, the eventKey property is not used. + * The eventHandlers object should be given as an object whose keys are standard + * event names (i.e. onClick) and whose values are event callbacks. The return value + * of an event handler is used to modify elemnts. The return value should be given + * as an object or an array of objects with optional target and eventKey keys, + * and a mutation key whose value is a function. The target and eventKey keys + * will default to those corresponding to the element the event handler was attached to. + * The mutation function will be called with the calculated props for the individual selected + * element (i.e. an area), and the object returned from the mutation function + * will override the props of the selected element via object assignment. + * @example + * events={[ + * { + * target: "data", + * eventHandlers: { + * onClick: () => { + * return [ + * { + * mutation: (props) => { + * return {style: merge({}, props.style, {fill: "orange"})}; + * } + * }, { + * target: "labels", + * mutation: () => { + * return {text: "hey"}; + * } + * } + * ]; + * } + * } + * } + * ]} + */ + events?: EventPropTypeInterface<"data" | "labels" | "parent", "all">[]; + /** + * The interpolation prop determines how data points should be connected when plotting a line + * @default "linear" + */ + interpolation?: InterpolationPropType; + /** + * The samples prop specifies how many individual points to plot when plotting + * y as a function of x. Samples is ignored if x props are provided instead. + * @default 50 + */ + samples?: number; + /** + * The style prop specifies styles for your VictoryArea. Any valid inline style properties + * will be applied. Height, width, and padding should be specified via the height, + * width, and padding props, as they are used to calculate the alignment of + * components within chart. + * @example {data: {fill: "red"}, labels: {fontSize: 12}} + */ + style?: VictoryStyleInterface; } /** @@ -1341,13 +1427,13 @@ declare module "victory" { */ cornerRadius?: NumberOrCallback | { - top?: number | (NumberOrCallback), - topLeft?: number | (NumberOrCallback), - topRight?: number | (NumberOrCallback), - bottom?: number | (NumberOrCallback), - bottomLeft?: number | (NumberOrCallback), - bottomRight?: number | (NumberOrCallback) - }; + top?: number | (NumberOrCallback), + topLeft?: number | (NumberOrCallback), + topRight?: number | (NumberOrCallback), + bottom?: number | (NumberOrCallback), + bottomLeft?: number | (NumberOrCallback), + bottomRight?: number | (NumberOrCallback) + }; /** * The event prop take an array of event objects. Event objects are composed of * a target, an eventKey, and eventHandlers. Targets may be any valid style namespace @@ -1418,917 +1504,924 @@ declare module "victory" { */ export class VictoryBar extends React.Component {} - export interface VictoryBoxPlotStyleInterface - extends VictoryStyleInterface { - max?: VictoryStyleObject; - maxLabels?: VictoryStyleObject; - min?: VictoryStyleObject; - minLabels?: VictoryStyleObject; - median?: VictoryStyleObject; - medianLabels?: VictoryStyleObject; - q1?: VictoryStyleObject; - q1Labels?: VictoryStyleObject; - q3?: VictoryStyleObject; - q3Labels?: VictoryStyleObject; - } - - export interface VictoryBoxPlotProps - extends VictoryCommonProps, - VictoryDatableProps { - /** - * The boxWidth prop specifies how wide each box should be. If the whiskerWidth - * prop is not set, this prop will also determine the width of the whisker crosshair. - */ - boxWidth?: number; - /** - * The domain prop describes the range of values your chart will include. This prop can be - * given as a array of the minimum and maximum expected values for your chart, - * or as an object that specifies separate arrays for x and y. - * If this prop is not provided, a domain will be calculated from data, or other - * available information. - * @example: [-1, 1], {x: [0, 100], y: [0, 1]} - */ - domain?: DomainPropType; - /** - * The domainPadding prop specifies a number of pixels of padding to add to the - * beginning and end of a domain. This prop is useful for explicitly spacing ticks farther - * from the origin to prevent crowding. This prop should be given as an object with - * numbers specified for x and y. - */ - domainPadding?: DomainPaddingPropType; - /** - * The event prop take an array of event objects. Event objects are composed of - * a childName, target, eventKey, and eventHandlers. Targets may be any valid style namespace - * for a given component, (i.e. "data" and "labels"). The childName will refer to an - * individual child of VictoryChart, either by its name prop, or by index. The eventKey - * may optionally be used to select a single element by index or eventKey rather than - * an entire set. The eventHandlers object should be given as an object whose keys are standard - * event names (i.e. onClick) and whose values are event callbacks. The return value - * of an event handler is used to modify elemnts. The return value should be given - * as an object or an array of objects with optional target and eventKey and childName keys, - * and a mutation key whose value is a function. The target and eventKey and childName keys - * will default to those corresponding to the element the event handler was attached to. - * The mutation function will be called with the calculated props for the individual selected - * element (i.e. a single bar), and the object returned from the mutation function - * will override the props of the selected element via object assignment. - * @examples - * events={[ - * { - * target: "data", - * childName: "firstBar", - * eventHandlers: { - * onClick: () => { - * return [ - * { - * childName: "secondBar", - * mutation: (props) => { - * return {style: merge({}, props.style, {fill: "orange"})}; - * } - * }, { - * childName: "secondBar", - * target: "labels", - * mutation: () => { - * return {text: "hey"}; - * } - * } - * ]; - * } - * } - * } - * ]} - */ - events?: EventPropTypeInterface[]; - /** - * Similar to data accessor props `x` and `y`, this prop may be used to functionally - * assign eventKeys to data - */ - eventKey?: StringOrNumberOrCallback; - /** - * The horizontal prop determines whether the bars will be laid vertically or - * horizontally. The bars will be vertical if this prop is false or unspecified, - * or horizontal if the prop is set to true. - */ - horizontal?: boolean; - /** - * The labelOrientation prop determines where labels are placed relative to their - * corresponding data. If this prop is not set, it will be set to “top” for - * horizontal charts, and “right” for vertical charts. - */ - labelOrientation?: "top" | "bottom" | "left" | "right"; - /** - * When the boolean labels prop is set to true, the values for min, max, median, - * q1, and q3 will be displayed for each box. For more granular label control, use - * the individual minLabels, maxLabels, medianLabels, q1Labels, and q3Labels props. - */ - labels?: boolean; - /** - * Use the max data accessor prop to define the max value of a box plot. - */ - max?: StringOrNumberOrCallback; - /** - * Use the median data accessor prop to define the median value of a box plot. - */ - median?: StringOrNumberOrCallback; - /** - * Use the min data accessor prop to define the min value of a box plot. - */ - min?: StringOrNumberOrCallback; - /** - * Use the q1 data accessor prop to define the q1 value of a box plot. - */ - q1?: StringOrNumberOrCallback; - /** - * Use the q3 data accessor prop to define the q1 value of a box plot. - */ - q3?: StringOrNumberOrCallback; - /** - * The style prop defines the style of the component. The style prop - * should be given as an object with styles defined for parent, max, - * maxLabels, min, minLabels,median, medianLabels,q1, q1Labels,q3, - * q3Labels. Any valid svg styles are supported, but width, height, a - * nd padding should be specified via props as they determine relative - * layout for components in VictoryChart. Functional styles may be - * defined for style properties, and they will be evaluated with each datum. - */ - style?: VictoryBoxPlotStyleInterface; - /** - * The whiskerWidth prop specifies how wide each whisker crosshair should be. If the - * whiskerWidth prop is not set, the width of the whisker crosshair will match - * the width of the box. - */ - whiskerWidth?: number; - } - - /** - * VictoryBoxPlot renders a box plot to describe the distribution of a set of data. Data for - * VictoryBoxPlot may be given with summary statistics pre-calculated (min, median, max, q1, q3), - * or as an array of raw data. VictoryBoxPlot can be composed with VictoryChart to create box plot charts. - */ - export class VictoryBoxPlot extends React.Component< - VictoryBoxPlotProps, - any - > {} - - export interface VictoryChartProps extends VictoryCommonProps { - /** - * The domain prop describes the range of values your chart will include. This prop can be - * given as a array of the minimum and maximum expected values for your chart, - * or as an object that specifies separate arrays for x and y. - * If this prop is not provided, a domain will be calculated from data, or other - * available information. - * @example: [-1, 1], {x: [0, 100], y: [0, 1]} - */ - domain?: DomainPropType; - /** - * The domainPadding prop specifies a number of pixels of padding to add to the - * beginning and end of a domain. This prop is useful for explicitly spacing ticks farther - * from the origin to prevent crowding. This prop should be given as an object with - * numbers specified for x and y. - */ - domainPadding?: DomainPaddingPropType; - /** - * The event prop take an array of event objects. Event objects are composed of - * a childName, target, eventKey, and eventHandlers. Targets may be any valid style namespace - * for a given component, (i.e. "data" and "labels"). The childName will refer to an - * individual child of VictoryChart, either by its name prop, or by index. The eventKey - * may optionally be used to select a single element by index or eventKey rather than - * an entire set. The eventHandlers object should be given as an object whose keys are standard - * event names (i.e. onClick) and whose values are event callbacks. The return value - * of an event handler is used to modify elemnts. The return value should be given - * as an object or an array of objects with optional target and eventKey and childName keys, - * and a mutation key whose value is a function. The target and eventKey and childName keys - * will default to those corresponding to the element the event handler was attached to. - * The mutation function will be called with the calculated props for the individual selected - * element (i.e. a single bar), and the object returned from the mutation function - * will override the props of the selected element via object assignment. - * @examples - * events={[ - * { - * target: "data", - * childName: "firstBar", - * eventHandlers: { - * onClick: () => { - * return [ - * { - * childName: "secondBar", - * mutation: (props) => { - * return {style: merge({}, props.style, {fill: "orange"})}; - * } - * }, { - * childName: "secondBar", - * target: "labels", - * mutation: () => { - * return {text: "hey"}; - * } - * } - * ]; - * } - * } - * } - * ]} - */ - events?: EventPropTypeInterface[]; - /** - * Similar to data accessor props `x` and `y`, this prop may be used to functionally - * assign eventKeys to data - */ - eventKey?: StringOrNumberOrCallback; - /** - * The style prop specifies styles for your chart. Any valid inline style properties - * will be applied. Height, width, and padding should be specified via the height, - * width, and padding props, as they are used to calculate the alignment of - * components within chart. - * @example {border: "1px solid #ccc", margin: "2%", maxWidth: "40%"} - */ - style?: Pick; - } - - /** - * A flexible charting component for React. - * VictoryChart composes other Victory components into reusable charts. - * Acting as a coordinator rather than a stand-alone component, VictoryChart reconciles props such as domain and scale for child components, - * and provides a set of sensible defaults. This component works with: - * - VictoryAxis - * - VictoryLine - * - VictoryScatter - * - VictoryBar - */ - export class VictoryChart extends React.Component {} - - export interface VictoryGroupProps extends VictoryCommonProps, VictoryMultiLabeableProps { - /** - * The categories prop specifies how categorical data for a chart should be ordered. - * This prop should be given as an array of string values, or an object with - * these values for x and y. When categories are not given as an object - * When this prop is set on a wrapper component, it will dictate the categories of - * its the children. If this prop is not set, any categories on child component - * or categorical data, will be merged to create a shared set of categories. - * @example ["dogs", "cats", "mice"] - */ - categories?: CategoryPropType; - /** - * The colorScale prop is an optional prop that defines the color scale the chart's bars - * will be created on. This prop should be given as an array of CSS colors, or as a string - * corresponding to one of the built in color scales. VictoryBar will automatically assign - * values from this color scale to the bars unless colors are explicitly provided in the - * `dataAttributes` prop. - */ - colorScale?: ColorScalePropType; - /** - * The domain prop describes the range of values your chart will include. This prop can be - * given as a array of the minimum and maximum expected values for your chart, - * or as an object that specifies separate arrays for x and y. - * If this prop is not provided, a domain will be calculated from data, or other - * available information. - * @examples: [-1, 1], {x: [0, 100], y: [0, 1]} - */ - domain?: DomainPropType; - /** - * The domainPadding prop specifies a number of pixels of padding to add to the - * beginning and end of a domain. This prop is useful for explicitly spacing ticks farther - * from the origin to prevent crowding. This prop should be given as an object with - * numbers specified for x and y. - */ - domainPadding?: DomainPaddingPropType; - /** - * The event prop take an array of event objects. Event objects are composed of - * a childName, target, eventKey, and eventHandlers. Targets may be any valid style namespace - * for a given component, (i.e. "data" and "labels"). The childName will refer to an - * individual child of VictoryGroup, either by its name prop, or by index. The eventKey - * may optionally be used to select a single element by index or eventKey rather than - * an entire set. The eventHandlers object should be given as an object whose keys are standard - * event names (i.e. onClick) and whose values are event callbacks. The return value - * of an event handler is used to modify elemnts. The return value should be given - * as an object or an array of objects with optional target and eventKey and childName keys, - * and a mutation key whose value is a function. The target and eventKey and childName keys - * will default to those corresponding to the element the event handler was attached to. - * The mutation function will be called with the calculated props for the individual selected - * element (i.e. a single bar), and the object returned from the mutation function - * will override the props of the selected element via object assignment. - * @examples - * events={[ - * { - * target: "data", - * childName: "firstBar", - * eventHandlers: { - * onClick: () => { - * return [ - * { - * childName: "secondBar", - * mutation: (props) => { - * return {style: merge({}, props.style, {fill: "orange"})}; - * } - * }, { - * childName: "secondBar", - * target: "labels", - * mutation: () => { - * return {text: "hey"}; - * } - * } - * ]; - * } - * } - * } - * ]} - */ - events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback>[]; - /** - * Similar to data accessor props `x` and `y`, this prop may be used to functionally - * assign eventKeys to data - */ - eventKey?: StringOrNumberOrCallback; - /** - * The horizontal prop determines whether the bars will be laid vertically or - * horizontally. The bars will be vertical if this prop is false or unspecified, - * or horizontal if the prop is set to true. - */ - horizontal?: boolean; - /** - * The offset prop determines the number of pixels each element in a group should - * be offset from its original position of the on the independent axis. In the - * case of groups of bars, this number should be equal to the width of the bar - * plus the desired spacing between bars. - */ - offset?: number; - /** - * The style prop specifies styles for your grouped chart. These styles will be - * applied to all grouped children - */ - style?: VictoryStyleInterface; - } - - export class VictoryGroup extends React.Component {} - - export interface VictoryLineProps extends VictoryCommonProps, VictoryDatableProps, VictorySingleLabableProps { - /** - * The event prop take an array of event objects. Event objects are composed of - * a target, an eventKey, and eventHandlers. Targets may be any valid style namespace - * for a given component, so "data" and "labels" are all valid targets for VictoryLine events. - * Since VictoryLine only renders a single element, the eventKey property is not used. - * The eventHandlers object should be given as an object whose keys are standard - * event names (i.e. onClick) and whose values are event callbacks. The return value - * of an event handler is used to modify elemnts. The return value should be given - * as an object or an array of objects with optional target and eventKey keys, - * and a mutation key whose value is a function. The target and eventKey keys - * will default to those corresponding to the element the event handler was attached to. - * The mutation function will be called with the calculated props for the individual selected - * element (i.e. a line), and the object returned from the mutation function - * will override the props of the selected element via object assignment. - * @examples - * events={[ - * { - * target: "data", - * eventHandlers: { - * onClick: () => { - * return [ - * { - * mutation: (props) => { - * return {style: merge({}, props.style, {stroke: "orange"})}; - * } - * }, { - * target: "labels", - * mutation: () => { - * return {text: "hey"}; - * } - * } - * ]; - * } - * } - * } - * ]} - */ - events?: EventPropTypeInterface<"data" | "labels" | "parent", number | string>[]; - /** - * The interpolation prop determines how data points should be connected - * when plotting a line - */ - interpolation?: InterpolationPropType; - /** - * The samples prop specifies how many individual points to plot when plotting - * y as a function of x. Samples is ignored if x props are provided instead. - */ - samples?: number; - /** - * The labels prop defines the labels that will appear above each point. - * This prop should be given as an array or as a function of data. - */ - labels?: string[]|number[]|Function; - /** - * Use the sortKey prop to indicate how data should be sorted. This prop - * is given directly to the lodash sortBy function to be executed on the - * final dataset. - */ - sortKey?: string|string[]|Function; - /** - * The style prop specifies styles for your VictoryLine. Any valid inline style properties - * will be applied. Height, width, and padding should be specified via the height, - * width, and padding props, as they are used to calculate the alignment of - * components within chart. in addition to normal style properties, angle and verticalAnchor - * may also be specified via the labels object, and they will be passed as props to - * VictoryLabel, or any custom labelComponent. - * @examples{data: {stroke: "red"}, labels: {fontSize: 12}} - */ - style?: VictoryStyleInterface; - } - - /** - * VictoryLine creates a line based on data. VictoryLine is a composable component, so it does not include an axis. - * Check out VictoryChart for easy to use line charts and more. - */ - export class VictoryLine extends React.Component {} - - export interface VictoryLegendProps extends VictoryCommonProps, VictoryDatableProps, VictorySingleLabableProps { - /** - * The colorScale prop defines a color scale to be applied to each data - * symbol in VictoryLegend. This prop should be given as an array of CSS - * colors, or as a string corresponding to one of the built in color - * scales: "grayscale", "qualitative", "heatmap", "warm", "cool", "red", - * "green", "blue". VictoryLegend will assign a color to each symbol by - * index, unless they are explicitly specified in the data object. - * Colors will repeat when there are more symbols than colors in the - * provided colorScale. - */ - colorScale?: ColorScalePropType; - /** - * The style prop defines the style of the VictoryLegend component. - * The style prop should be given as an object with styles defined for data, labels and - * parent. Any valid svg styles are supported, but width, height, and - * padding should be specified via props as they determine relative - * layout for components in VictoryLegend. - */ - style?: VictoryStyleInterface; - /** - * The containerComponent prop takes a component instance which will be - * used to create a container element for standalone legends. The new - * element created from the passed containerComponent will be provided - * with the following props: height, width, children (the legend itself) - * and style. If a containerComponent is not provided, the default - * VictoryContainer component will be used. VictoryContainer supports - * title and desc props, which are intended to add accessibility to - * Victory components. The more descriptive these props are, the more - * accessible your data will be for people using screen readers. These - * props may be set by passing them directly to the supplied component. - * By default, VictoryContainer renders a responsive svg using the - * viewBox attribute. To render a static container, set - * responsive={false} directly on the instance of VictoryContainer - * supplied via the containerComponent prop. VictoryContainer also - * renders a Portal element that may be used in conjunction with - * VictoryPortal to force components to render above other children. - * @default - */ - containerComponent?: React.ReactElement; - /** - * Specify data via the data prop. VictoryLegend expects data as an - * array of objects with name (required), symbol, and labels properties. - * The data prop must be given as an array. - */ - data?: Array<{ - name?: string; - symbol?: { - fill?: string; - type?: string; - }; - }>; - /** - * The itemsPerRow prop determines how many items to render in each row - * of a horizontal legend, or in each column of a vertical legend. This - * prop should be given as an integer. When this prop is not given, - * legend items will be rendered in a single row or column. - */ - itemsPerRow?: number; - /** - * The dataComponent prop takes a component instance which will be - * responsible for rendering a data element used to associate a symbol - * or color with each data series. The new element created from the - * passed dataComponent will be provided with the following properties - * calculated by VictoryLegend: x, y, size, style, and symbol. Any of - * these props may be overridden by passing in props to the supplied - * component, or modified or ignored within the custom component itself. - * If a dataComponent is not provided, VictoryLegend will use its - * default Point component. - */ - dataComponent?: React.ReactElement; - /** - * The groupComponent prop takes an entire component which will be used to - * create group elements for use within container elements. This prop defaults - * to a tag on web, and a react-native-svg tag on mobile - * @default - */ - groupComponent?: React.ReactElement; - /** - * The gutter prop defines the number of pixels between legend rows or - * columns, depending on orientation. When orientation is horizontal, - * gutters are between columns. When orientation is vertical, gutters - * are the space between rows. - */ - gutter?: number; - /** - * The labelComponent prop takes a component instance which will be used - * to render each legend label. The new element created from the passed - * labelComponent will be supplied with the following properties: x, y, - * style, and text. Any of these props may be overridden by passing in - * props to the supplied component, or modified or ignored within the - * custom component itself. If labelComponent is omitted, a new - * VictoryLabel will be created with the props described above. - */ - labelComponent?: React.ReactElement; - /** - * The orientation prop takes a string that defines whether legend data - * are displayed in a row or column. When orientation is "horizontal", - * legend items will be displayed in a single row. When orientation is - * "vertical", legend items will be displayed in a single column. Line - * and text-wrapping is not currently supported, so "vertical" - * orientation is both the default setting and recommended for - * displaying many series of data. - * @default 'vertical' - */ - orientation?: 'horizontal'|'vertical'; - /** - * The padding prop specifies the amount of padding in pixels between - * the edge of the legend and any rendered child components. This prop - * can be given as a number or as an object with padding specified for - * top, bottom, left and right. As with width and height, the absolute - * padding will depend on whether the component is rendered in a - * responsive container. When a component is nested within - * VictoryLegend, setting padding on the child component will have no - * effect. - */ - padding?: number | { - top?: number; - bottom?: number; - left?: number; - right?: number; - }; - /** - * The standalone props specifies whether the component should be - * rendered in an independent element or in a tag. This prop - * defaults to true, and renders an svg. - */ - standalone?: boolean; - /** - * The symbolSpacer prop defines the number of pixels between data - * components and label components. - */ - symbolSpacer?: number; - /** - * The width and height props define the width and height of the legend. - * These props may be given as positive numbers or functions of data. If - * these props are not set, width and height will be determined based on - * an approximate text size calculated from the text and style props - * provided to VictoryLegend. - */ - width?: number; - height?: number; - /** - * The x and y props define the base position of the legend element. - */ - x?: number; - y?: number; - } - - /** - * VictoryLegend renders a chart legend component. - */ - export class VictoryLegend extends React.Component {} - - type ScatterSymbolType = "circle" | "diamond" | "plus" | "square" | "star" | "triangleDown" | "triangleUp"; - - export interface VictoryScatterProps extends VictoryCommonProps, VictoryDatableProps, VictoryMultiLabeableProps { - /** - * The bubbleProperty prop indicates which property of the data object should be used - * to scale data points in a bubble chart - */ - bubbleProperty?: string; - /** - * The event prop take an array of event objects. Event objects are composed of - * a target, an eventKey, and eventHandlers. Targets may be any valid style namespace - * for a given component, so "data" and "labels" are all valid targets for VictoryScatter - * events. The eventKey may optionally be used to select a single element by index rather than - * an entire set. The eventHandlers object should be given as an object whose keys are standard - * event names (i.e. onClick) and whose values are event callbacks. The return value - * of an event handler is used to modify elemnts. The return value should be given - * as an object or an array of objects with optional target and eventKey keys, - * and a mutation key whose value is a function. The target and eventKey keys - * will default to those corresponding to the element the event handler was attached to. - * The mutation function will be called with the calculated props for the individual selected - * element (i.e. a single bar), and the object returned from the mutation function - * will override the props of the selected element via object assignment. - * @examples - * events={[ - * { - * target: "data", - * eventKey: "thisOne", - * eventHandlers: { - * onClick: () => { - * return [ - * { - * eventKey: "theOtherOne", - * mutation: (props) => { - * return {style: merge({}, props.style, {fill: "orange"})}; - * } - * }, { - * eventKey: "theOtherOne", - * target: "labels", - * mutation: () => { - * return {text: "hey"}; - * } - * } - * ]; - * } - * } - * } - * ]} - */ - events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback>[]; - /** - * Similar to data accessor props `x` and `y`, this prop may be used to functionally - * assign eventKeys to data - */ - eventKey?: StringOrNumberOrCallback; - /** - * The maxBubbleSize prop sets an upper limit for scaling data points in a bubble chart - */ - maxBubbleSize?: number; - /** - * The samples prop specifies how many individual points to plot when plotting - * y as a function of x. Samples is ignored if x props are provided instead. - */ - samples?: number; - /** - * The size prop determines how to scale each data point - */ - size?: number | { (data: any): number } | { (data: any, active: boolean): number }; - /** - * The style prop specifies styles for your VictoryScatter. Any valid inline style properties - * will be applied. Height, width, and padding should be specified via the height, - * width, and padding props, as they are used to calculate the alignment of - * components within chart. In addition to normal style properties, angle and verticalAnchor - * may also be specified via the labels object, and they will be passed as props to - * VictoryLabel, or any custom labelComponent. - * @example {data: {fill: "red"}, labels: {fontSize: 12}} - */ - style?: VictoryStyleInterface; - /** - * The symbol prop determines which symbol should be drawn to represent data points. - */ - symbol?: ScatterSymbolType | { (data: any): ScatterSymbolType }; - } - - /** - * VictoryScatter creates a scatter of points from data. VictoryScatter is a composable component, so it does not include an axis. - * Check out VictoryChart for easy to use scatter plots and more. - */ - export class VictoryScatter extends React.Component {} - - export interface VictoryStackProps extends VictoryCommonProps, VictoryMultiLabeableProps { - /** - * The categories prop specifies how categorical data for a chart should be ordered. - * This prop should be given as an array of string values, or an object with - * these values for x and y. When categories are not given as an object - * When this prop is set on a wrapper component, it will dictate the categories of - * its the children. If this prop is not set, any categories on child component - * or catigorical data, will be merged to create a shared set of categories. - * @example ["dogs", "cats", "mice"] - */ - categories?: CategoryPropType; - /** - * The colorScale prop is an optional prop that defines the color scale the chart's bars - * will be created on. This prop should be given as an array of CSS colors, or as a string - * corresponding to one of the built in color scales. VictoryBar will automatically assign - * values from this color scale to the bars unless colors are explicitly provided in the - * `dataAttributes` prop. - */ - colorScale?: ColorScalePropType; - /** - * The domain prop describes the range of values your chart will include. This prop can be - * given as a array of the minimum and maximum expected values for your chart, - * or as an object that specifies separate arrays for x and y. - * If this prop is not provided, a domain will be calculated from data, or other - * available information. - * @example: [-1, 1], {x: [0, 100], y: [0, 1]} - */ - domain?: DomainPropType; - /** - * The domainPadding prop specifies a number of pixels of padding to add to the - * beginning and end of a domain. This prop is useful for explicitly spacing ticks farther - * from the origin to prevent crowding. This prop should be given as an object with - * numbers specified for x and y. - */ - domainPadding?: DomainPaddingPropType; - /** - * The event prop take an array of event objects. Event objects are composed of - * a childName, target, eventKey, and eventHandlers. Targets may be any valid style namespace - * for a given component, (i.e. "data" and "labels"). The childName will refer to an - * individual child of VictoryStack, either by its name prop, or by index. The eventKey - * may optionally be used to select a single element by index or eventKey rather than - * an entire set. The eventHandlers object should be given as an object whose keys are standard - * event names (i.e. onClick) and whose values are event callbacks. The return value - * of an event handler is used to modify elemnts. The return value should be given - * as an object or an array of objects with optional target and eventKey and childName keys, - * and a mutation key whose value is a function. The target and eventKey and childName keys - * will default to those corresponding to the element the event handler was attached to. - * The mutation function will be called with the calculated props for the individual selected - * element (i.e. a single bar), and the object returned from the mutation function - * will override the props of the selected element via object assignment. - * @examples - * events={[ - * { - * target: "data", - * childName: "firstBar", - * eventHandlers: { - * onClick: () => { - * return [ - * { - * childName: "secondBar", - * mutation: (props) => { - * return {style: merge({}, props.style, {fill: "orange"})}; - * } - * }, { - * childName: "secondBar", - * target: "labels", - * mutation: () => { - * return {text: "hey"}; - * } - * } - * ]; - * } - * } - * } - * ]} - */ - events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback>[]; - /** - * Similar to data accessor props `x` and `y`, this prop may be used to functionally - * assign eventKeys to data - */ - eventKey?: StringOrNumberOrCallback; - /** - * The horizontal prop determines whether the bars will be laid vertically or - * horizontally. The bars will be vertical if this prop is false or unspecified, - * or horizontal if the prop is set to true. - */ - horizontal?: boolean; - /** - * The style prop specifies styles for your grouped chart. These styles will be - * applied to all grouped children - */ - style?: VictoryStyleInterface; - /** - * The xOffset prop is used for grouping stacks of bars. This prop will be set - * by the VictoryGroup component wrapper, or can be set manually. - */ - xOffset?: number; - } - - export class VictoryStack extends React.Component {} - - export interface VictoryPieProps extends VictoryCommonProps, VictoryMultiLabeableProps { - /** - * The colorScale prop is an optional prop that defines the color scale the pie - * will be created on. This prop should be given as an array of CSS colors, or as a string - * corresponding to one of the built in color scales. VictoryPie will automatically assign - * values from this color scale to the pie slices unless colors are explicitly provided in the - * data object - */ - colorScale?: ColorScalePropType; - /** - * The data prop specifies the data to be plotted, - * where data X-value is the slice label (string or number), - * and Y-value is the corresponding number value represented by the slice - * Data should be in the form of an array of data points. - * Each data point may be any format you wish (depending on the `x` and `y` accessor props), - * but by default, an object with x and y properties is expected. - * @example [{x: 1, y: 2}, {x: 2, y: 3}], [[1, 2], [2, 3]], - * [[{x: "a", y: 1}, {x: "b", y: 2}], [{x: "a", y: 2}, {x: "b", y: 3}]] - */ - data?: any[]; - /** - * The dataComponent prop takes an entire, HTML-complete data component which will be used to - * create slices for each datum in the pie chart. The new element created from the passed - * dataComponent will have the property datum set by the pie chart for the point it renders; - * properties style and pathFunction calculated by VictoryPie; an index property set - * corresponding to the location of the datum in the data provided to the pie; events bound to - * the VictoryPie; and the d3 compatible slice object. - * If a dataComponent is not provided, VictoryPie's Slice component will be used. - */ - dataComponent?: React.ReactElement; - /** - * The labelRadius prop defines the radius of the arc that will be used for positioning each slice label. - * If this prop is not set, the label radius will default to the radius of the pie + label padding. - */ - labelRadius?: number; - /** - * The overall end angle of the pie in degrees. This prop is used in conjunction with - * startAngle to create a pie that spans only a segment of a circle. - */ - endAngle?: number; - /** - * The event prop takes an array of event objects. Event objects are composed of - * a target, an eventKey, and eventHandlers. Targets may be any valid style namespace - * for a given component, so "data" and "labels" are all valid targets for VictoryPie - * events. The eventKey may optionally be used to select a single element by index rather than - * an entire set. The eventHandlers object should be given as an object whose keys are standard - * event names (i.e. onClick) and whose values are event callbacks. The return value - * of an event handler is used to modify elemnts. The return value should be given - * as an object or an array of objects with optional target and eventKey keys, - * and a mutation key whose value is a function. The target and eventKey keys - * will default to those corresponding to the element the event handler was attached to. - * The mutation function will be called with the calculated props for the individual selected - * element (i.e. a single bar), and the object returned from the mutation function - * will override the props of the selected element via object assignment. - * @examples - * events={[ - * { - * target: "data", - * eventKey: 1, - * eventHandlers: { - * onClick: () => { - * return [ - * { - * eventKey: 2, - * mutation: (props) => { - * return {style: merge({}, props.style, {fill: "orange"})}; - * } - * }, { - * eventKey: 2, - * target: "labels", - * mutation: () => { - * return {text: "hey"}; - * } - * } - * ]; - * } - * } - * } - * ]} - */ - events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback | string[] | number[]>[]; - /** - * Similar to data accessor props `x` and `y`, this prop may be used to functionally - * assign eventKeys to data - */ - eventKey?: StringOrNumberOrCallback; - /** - * Specifies the radius of the chart. If this property is not provided it is computed - * from width, height, and padding props - * - */ - radius?: number; - /** - * When creating a donut chart, this prop determines the number of pixels between - * the center of the chart and the inner edge of a donut. When this prop is set to zero - * a regular pie chart is rendered. - */ - innerRadius?: number; - /** - * Set the cornerRadius for every dataComponent (Slice by default) within VictoryPie - */ - cornerRadius?: number; - /** - * The padAngle prop determines the amount of separation between adjacent data slices - * in number of degrees - */ - padAngle?: number; - /** - * The overall start angle of the pie in degrees. This prop is used in conjunction with - * endAngle to create a pie that spans only a segment of a circle. - */ - startAngle?: number; - /** - * The style prop specifies styles for your pie. VictoryPie relies on Radium, - * so valid Radium style objects should work for this prop. Height, width, and - * padding should be specified via the height, width, and padding props. - * @example {data: {stroke: "black"}, label: {fontSize: 10}} - */ - style?: VictoryStyleInterface; - /** - * The x prop specifies how to access the X value of each data point. - * If given as a function, it will be run on each data point, and returned value will be used. - * If given as an integer, it will be used as an array index for array-type data points. - * If given as a string, it will be used as a property key for object-type data points. - * If given as an array of strings, or a string containing dots or brackets, - * it will be used as a nested object property path (for details see Lodash docs for _.get). - * If `null` or `undefined`, the data value will be used as is (identity function/pass-through). - * @example 0, 'x', 'x.value.nested.1.thing', 'x[2].also.nested', null, d => Math.sin(d) - */ - x?: DataGetterPropType; - /** - * The y prop specifies how to access the Y value of each data point. - * If given as a function, it will be run on each data point, and returned value will be used. - * If given as an integer, it will be used as an array index for array-type data points. - * If given as a string, it will be used as a property key for object-type data points. - * If given as an array of strings, or a string containing dots or brackets, - * it will be used as a nested object property path (for details see Lodash docs for _.get). - * If `null` or `undefined`, the data value will be used as is (identity function/pass-through). - * @example 0, 'y', 'y.value.nested.1.thing', 'y[2].also.nested', null, d => Math.sin(d) - */ - y?: DataGetterPropType; - } - - /** - * victory-pie draws an SVG pie or donut chart with React. - * Styles and data can be customized by passing in your own values as properties to the component. - * Data changes are animated with VictoryAnimation. - */ - export class VictoryPie extends React.Component {} + export interface VictoryBoxPlotStyleInterface extends VictoryStyleInterface { + max?: VictoryStyleObject; + maxLabels?: VictoryStyleObject; + min?: VictoryStyleObject; + minLabels?: VictoryStyleObject; + median?: VictoryStyleObject; + medianLabels?: VictoryStyleObject; + q1?: VictoryStyleObject; + q1Labels?: VictoryStyleObject; + q3?: VictoryStyleObject; + q3Labels?: VictoryStyleObject; } + + export interface VictoryBoxPlotProps extends VictoryCommonProps, VictoryDatableProps { + /** + * The boxWidth prop specifies how wide each box should be. If the whiskerWidth + * prop is not set, this prop will also determine the width of the whisker crosshair. + */ + boxWidth?: number; + /** + * The domain prop describes the range of values your chart will include. This prop can be + * given as a array of the minimum and maximum expected values for your chart, + * or as an object that specifies separate arrays for x and y. + * If this prop is not provided, a domain will be calculated from data, or other + * available information. + * @example: [-1, 1], {x: [0, 100], y: [0, 1]} + */ + domain?: DomainPropType; + /** + * The domainPadding prop specifies a number of pixels of padding to add to the + * beginning and end of a domain. This prop is useful for explicitly spacing ticks farther + * from the origin to prevent crowding. This prop should be given as an object with + * numbers specified for x and y. + */ + domainPadding?: DomainPaddingPropType; + /** + * The event prop take an array of event objects. Event objects are composed of + * a childName, target, eventKey, and eventHandlers. Targets may be any valid style namespace + * for a given component, (i.e. "data" and "labels"). The childName will refer to an + * individual child of VictoryChart, either by its name prop, or by index. The eventKey + * may optionally be used to select a single element by index or eventKey rather than + * an entire set. The eventHandlers object should be given as an object whose keys are standard + * event names (i.e. onClick) and whose values are event callbacks. The return value + * of an event handler is used to modify elemnts. The return value should be given + * as an object or an array of objects with optional target and eventKey and childName keys, + * and a mutation key whose value is a function. The target and eventKey and childName keys + * will default to those corresponding to the element the event handler was attached to. + * The mutation function will be called with the calculated props for the individual selected + * element (i.e. a single bar), and the object returned from the mutation function + * will override the props of the selected element via object assignment. + * @examples + * events={[ + * { + * target: "data", + * childName: "firstBar", + * eventHandlers: { + * onClick: () => { + * return [ + * { + * childName: "secondBar", + * mutation: (props) => { + * return {style: merge({}, props.style, {fill: "orange"})}; + * } + * }, { + * childName: "secondBar", + * target: "labels", + * mutation: () => { + * return {text: "hey"}; + * } + * } + * ]; + * } + * } + * } + * ]} + */ + events?: EventPropTypeInterface[]; + /** + * Similar to data accessor props `x` and `y`, this prop may be used to functionally + * assign eventKeys to data + */ + eventKey?: StringOrNumberOrCallback; + /** + * The horizontal prop determines whether the bars will be laid vertically or + * horizontally. The bars will be vertical if this prop is false or unspecified, + * or horizontal if the prop is set to true. + */ + horizontal?: boolean; + /** + * The labelOrientation prop determines where labels are placed relative to their + * corresponding data. If this prop is not set, it will be set to “top” for + * horizontal charts, and “right” for vertical charts. + */ + labelOrientation?: "top" | "bottom" | "left" | "right"; + /** + * When the boolean labels prop is set to true, the values for min, max, median, + * q1, and q3 will be displayed for each box. For more granular label control, use + * the individual minLabels, maxLabels, medianLabels, q1Labels, and q3Labels props. + */ + labels?: boolean; + /** + * Use the max data accessor prop to define the max value of a box plot. + */ + max?: StringOrNumberOrCallback; + /** + * Use the median data accessor prop to define the median value of a box plot. + */ + median?: StringOrNumberOrCallback; + /** + * Use the min data accessor prop to define the min value of a box plot. + */ + min?: StringOrNumberOrCallback; + /** + * Use the q1 data accessor prop to define the q1 value of a box plot. + */ + q1?: StringOrNumberOrCallback; + /** + * Use the q3 data accessor prop to define the q1 value of a box plot. + */ + q3?: StringOrNumberOrCallback; + /** + * The style prop defines the style of the component. The style prop + * should be given as an object with styles defined for parent, max, + * maxLabels, min, minLabels,median, medianLabels,q1, q1Labels,q3, + * q3Labels. Any valid svg styles are supported, but width, height, a + * nd padding should be specified via props as they determine relative + * layout for components in VictoryChart. Functional styles may be + * defined for style properties, and they will be evaluated with each datum. + */ + style?: VictoryBoxPlotStyleInterface; + /** + * The whiskerWidth prop specifies how wide each whisker crosshair should be. If the + * whiskerWidth prop is not set, the width of the whisker crosshair will match + * the width of the box. + */ + whiskerWidth?: number; + } + + /** + * VictoryBoxPlot renders a box plot to describe the distribution of a set of data. Data for + * VictoryBoxPlot may be given with summary statistics pre-calculated (min, median, max, q1, q3), + * or as an array of raw data. VictoryBoxPlot can be composed with VictoryChart to create box plot charts. + */ + export class VictoryBoxPlot extends React.Component< + VictoryBoxPlotProps, + any + > {} + + export interface VictoryChartProps extends VictoryCommonProps { + /** + * The domain prop describes the range of values your chart will include. This prop can be + * given as a array of the minimum and maximum expected values for your chart, + * or as an object that specifies separate arrays for x and y. + * If this prop is not provided, a domain will be calculated from data, or other + * available information. + * @example: [-1, 1], {x: [0, 100], y: [0, 1]} + */ + domain?: DomainPropType; + /** + * The domainPadding prop specifies a number of pixels of padding to add to the + * beginning and end of a domain. This prop is useful for explicitly spacing ticks farther + * from the origin to prevent crowding. This prop should be given as an object with + * numbers specified for x and y. + */ + domainPadding?: DomainPaddingPropType; + /** + * The event prop take an array of event objects. Event objects are composed of + * a childName, target, eventKey, and eventHandlers. Targets may be any valid style namespace + * for a given component, (i.e. "data" and "labels"). The childName will refer to an + * individual child of VictoryChart, either by its name prop, or by index. The eventKey + * may optionally be used to select a single element by index or eventKey rather than + * an entire set. The eventHandlers object should be given as an object whose keys are standard + * event names (i.e. onClick) and whose values are event callbacks. The return value + * of an event handler is used to modify elemnts. The return value should be given + * as an object or an array of objects with optional target and eventKey and childName keys, + * and a mutation key whose value is a function. The target and eventKey and childName keys + * will default to those corresponding to the element the event handler was attached to. + * The mutation function will be called with the calculated props for the individual selected + * element (i.e. a single bar), and the object returned from the mutation function + * will override the props of the selected element via object assignment. + * @examples + * events={[ + * { + * target: "data", + * childName: "firstBar", + * eventHandlers: { + * onClick: () => { + * return [ + * { + * childName: "secondBar", + * mutation: (props) => { + * return {style: merge({}, props.style, {fill: "orange"})}; + * } + * }, { + * childName: "secondBar", + * target: "labels", + * mutation: () => { + * return {text: "hey"}; + * } + * } + * ]; + * } + * } + * } + * ]} + */ + events?: EventPropTypeInterface[]; + /** + * Similar to data accessor props `x` and `y`, this prop may be used to functionally + * assign eventKeys to data + */ + eventKey?: StringOrNumberOrCallback; + /** + * The style prop specifies styles for your chart. Any valid inline style properties + * will be applied. Height, width, and padding should be specified via the height, + * width, and padding props, as they are used to calculate the alignment of + * components within chart. + * @example {border: "1px solid #ccc", margin: "2%", maxWidth: "40%"} + */ + style?: Pick; + } + + /** + * A flexible charting component for React. + * VictoryChart composes other Victory components into reusable charts. + * Acting as a coordinator rather than a stand-alone component, VictoryChart reconciles props such as domain and scale for child components, + * and provides a set of sensible defaults. This component works with: + * - VictoryAxis + * - VictoryLine + * - VictoryScatter + * - VictoryBar + */ + export class VictoryChart extends React.Component {} + + export interface VictoryGroupProps extends VictoryCommonProps, VictoryMultiLabeableProps { + /** + * The categories prop specifies how categorical data for a chart should be ordered. + * This prop should be given as an array of string values, or an object with + * these values for x and y. When categories are not given as an object + * When this prop is set on a wrapper component, it will dictate the categories of + * its the children. If this prop is not set, any categories on child component + * or categorical data, will be merged to create a shared set of categories. + * @example ["dogs", "cats", "mice"] + */ + categories?: CategoryPropType; + /** + * The colorScale prop is an optional prop that defines the color scale the chart's bars + * will be created on. This prop should be given as an array of CSS colors, or as a string + * corresponding to one of the built in color scales. VictoryBar will automatically assign + * values from this color scale to the bars unless colors are explicitly provided in the + * `dataAttributes` prop. + */ + colorScale?: ColorScalePropType; + /** + * The domain prop describes the range of values your chart will include. This prop can be + * given as a array of the minimum and maximum expected values for your chart, + * or as an object that specifies separate arrays for x and y. + * If this prop is not provided, a domain will be calculated from data, or other + * available information. + * @examples: [-1, 1], {x: [0, 100], y: [0, 1]} + */ + domain?: DomainPropType; + /** + * The domainPadding prop specifies a number of pixels of padding to add to the + * beginning and end of a domain. This prop is useful for explicitly spacing ticks farther + * from the origin to prevent crowding. This prop should be given as an object with + * numbers specified for x and y. + */ + domainPadding?: DomainPaddingPropType; + /** + * The event prop take an array of event objects. Event objects are composed of + * a childName, target, eventKey, and eventHandlers. Targets may be any valid style namespace + * for a given component, (i.e. "data" and "labels"). The childName will refer to an + * individual child of VictoryGroup, either by its name prop, or by index. The eventKey + * may optionally be used to select a single element by index or eventKey rather than + * an entire set. The eventHandlers object should be given as an object whose keys are standard + * event names (i.e. onClick) and whose values are event callbacks. The return value + * of an event handler is used to modify elemnts. The return value should be given + * as an object or an array of objects with optional target and eventKey and childName keys, + * and a mutation key whose value is a function. The target and eventKey and childName keys + * will default to those corresponding to the element the event handler was attached to. + * The mutation function will be called with the calculated props for the individual selected + * element (i.e. a single bar), and the object returned from the mutation function + * will override the props of the selected element via object assignment. + * @examples + * events={[ + * { + * target: "data", + * childName: "firstBar", + * eventHandlers: { + * onClick: () => { + * return [ + * { + * childName: "secondBar", + * mutation: (props) => { + * return {style: merge({}, props.style, {fill: "orange"})}; + * } + * }, { + * childName: "secondBar", + * target: "labels", + * mutation: () => { + * return {text: "hey"}; + * } + * } + * ]; + * } + * } + * } + * ]} + */ + events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback>[]; + /** + * Similar to data accessor props `x` and `y`, this prop may be used to functionally + * assign eventKeys to data + */ + eventKey?: StringOrNumberOrCallback; + /** + * The horizontal prop determines whether the bars will be laid vertically or + * horizontally. The bars will be vertical if this prop is false or unspecified, + * or horizontal if the prop is set to true. + */ + horizontal?: boolean; + /** + * The offset prop determines the number of pixels each element in a group should + * be offset from its original position of the on the independent axis. In the + * case of groups of bars, this number should be equal to the width of the bar + * plus the desired spacing between bars. + */ + offset?: number; + /** + * The style prop specifies styles for your grouped chart. These styles will be + * applied to all grouped children + */ + style?: VictoryStyleInterface; + } + + export class VictoryGroup extends React.Component {} + + export interface VictoryLineProps extends VictoryCommonProps, VictoryDatableProps, VictorySingleLabableProps { + /** + * The event prop take an array of event objects. Event objects are composed of + * a target, an eventKey, and eventHandlers. Targets may be any valid style namespace + * for a given component, so "data" and "labels" are all valid targets for VictoryLine events. + * Since VictoryLine only renders a single element, the eventKey property is not used. + * The eventHandlers object should be given as an object whose keys are standard + * event names (i.e. onClick) and whose values are event callbacks. The return value + * of an event handler is used to modify elemnts. The return value should be given + * as an object or an array of objects with optional target and eventKey keys, + * and a mutation key whose value is a function. The target and eventKey keys + * will default to those corresponding to the element the event handler was attached to. + * The mutation function will be called with the calculated props for the individual selected + * element (i.e. a line), and the object returned from the mutation function + * will override the props of the selected element via object assignment. + * @examples + * events={[ + * { + * target: "data", + * eventHandlers: { + * onClick: () => { + * return [ + * { + * mutation: (props) => { + * return {style: merge({}, props.style, {stroke: "orange"})}; + * } + * }, { + * target: "labels", + * mutation: () => { + * return {text: "hey"}; + * } + * } + * ]; + * } + * } + * } + * ]} + */ + events?: EventPropTypeInterface<"data" | "labels" | "parent", number | string>[]; + /** + * The interpolation prop determines how data points should be connected + * when plotting a line + */ + interpolation?: InterpolationPropType; + /** + * The samples prop specifies how many individual points to plot when plotting + * y as a function of x. Samples is ignored if x props are provided instead. + */ + samples?: number; + /** + * The labels prop defines the labels that will appear above each point. + * This prop should be given as an array or as a function of data. + */ + labels?: string[] | number[] | Function; + /** + * Use the sortKey prop to indicate how data should be sorted. This prop + * is given directly to the lodash sortBy function to be executed on the + * final dataset. + */ + sortKey?: string | string[] | Function; + /** + * The style prop specifies styles for your VictoryLine. Any valid inline style properties + * will be applied. Height, width, and padding should be specified via the height, + * width, and padding props, as they are used to calculate the alignment of + * components within chart. in addition to normal style properties, angle and verticalAnchor + * may also be specified via the labels object, and they will be passed as props to + * VictoryLabel, or any custom labelComponent. + * @examples{data: {stroke: "red"}, labels: {fontSize: 12}} + */ + style?: VictoryStyleInterface; + } + + /** + * VictoryLine creates a line based on data. VictoryLine is a composable component, so it does not include an axis. + * Check out VictoryChart for easy to use line charts and more. + */ + export class VictoryLine extends React.Component {} + + export interface VictoryLegendProps extends VictoryCommonProps, VictoryDatableProps, VictorySingleLabableProps { + /** + * The borderComponent prop takes a component instance which will be responsible + * for rendering a border around the legend. The new element created from the passed + * borderComponent will be provided with the following properties calculated by + * VictoryLegend: x, y, width, height, and style. Any of these props may be + * overridden by passing in props to the supplied component, or modified or ignored + * within the custom component itself. If a borderComponent + * is not provided, VictoryLegend will use its default Border component. + * Please note that the default width and height calculated + * for the border component is based on approximated + * text measurements, and may need to be adjusted. + * @default + */ + borderComponent?: React.ReactElement; + /** + * The borderPadding specifies the amount of padding that should + * be added between the legend items and the border. This prop may be given as + * a number, or asanobject with values specified for top, bottom, left, and right. + * Please note that the default width and height calculated for the border + * component is based on approximated text measurements, so padding may need to be adjusted. + */ + borderPadding?: PaddingProps; + /** + * The centerTitle boolean prop specifies whether a legend title should be centered. + */ + centerTitle?: boolean; + /** + * The colorScale prop defines a color scale to be applied to each data + * symbol in VictoryLegend. This prop should be given as an array of CSS + * colors, or as a string corresponding to one of the built in color + * scales: "grayscale", "qualitative", "heatmap", "warm", "cool", "red", + * "green", "blue". VictoryLegend will assign a color to each symbol by + * index, unless they are explicitly specified in the data object. + * Colors will repeat when there are more symbols than colors in the + * provided colorScale. + */ + colorScale?: ColorScalePropType; + /** + * Specify data via the data prop. VictoryLegend expects data as an + * array of objects with name (required), symbol, and labels properties. + * The data prop must be given as an array. + */ + data?: Array<{ + name?: string; + symbol?: { + fill?: string; + type?: string; + }; + }>; + /** + * The dataComponent prop takes a component instance which will be + * responsible for rendering a data element used to associate a symbol + * or color with each data series. The new element created from the + * passed dataComponent will be provided with the following properties + * calculated by VictoryLegend: x, y, size, style, and symbol. Any of + * these props may be overridden by passing in props to the supplied + * component, or modified or ignored within the custom component itself. + * If a dataComponent is not provided, VictoryLegend will use its + * default Point component. + */ + dataComponent?: React.ReactElement; + /** + * VictoryLegend uses the standard eventKey prop to specify how event targets + * are addressed. This prop is not commonly used. + */ + eventKey?: StringOrNumberOrCallback | string[]; + /** + * VictoryLegend uses the standard events prop. + */ + events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback>[]; + /** + * VictoryLegend uses the standard externalEventMutations prop. + */ + externalEventMutations?: any[]; + /** + * The gutter prop defines the number of pixels between legend rows or + * columns, depending on orientation. When orientation is horizontal, + * gutters are between columns. When orientation is vertical, gutters + * are the space between rows. + */ + gutter?: number; + /** + * The itemsPerRow prop determines how many items to render in each row + * of a horizontal legend, or in each column of a vertical legend. This + * prop should be given as an integer. When this prop is not given, + * legend items will be rendered in a single row or column. + */ + itemsPerRow?: number; + /** + * The labelComponent prop takes a component instance which will be used + * to render each legend label. The new element created from the passed + * labelComponent will be supplied with the following properties: x, y, + * style, and text. Any of these props may be overridden by passing in + * props to the supplied component, or modified or ignored within the + * custom component itself. If labelComponent is omitted, a new + * VictoryLabel will be created with the props described above. + */ + labelComponent?: React.ReactElement; + /** + * The orientation prop takes a string that defines whether legend data + * are displayed in a row or column. When orientation is "horizontal", + * legend items will be displayed in a single row. When orientation is + * "vertical", legend items will be displayed in a single column. Line + * and text-wrapping is not currently supported, so "vertical" + * orientation is both the default setting and recommended for + * displaying many series of data. + * @default 'vertical' + */ + orientation?: 'horizontal' | 'vertical'; + /** + * The rowGutter prop defines the number of pixels between legend rows. + * This prop may be given as a number, or as an object with values + * specified for “top” and “bottom” gutters. To set spacing between columns, + * use the gutter prop. + */ + rowGutter?: number | Omit; + /** + * The style prop defines the style of the VictoryLegend component. + * The style prop should be given as an object with styles defined for data, labels and + * parent. Any valid svg styles are supported, but width, height, and + * padding should be specified via props as they determine relative + * layout for components in VictoryLegend. + */ + style?: VictoryStyleInterface; + /** + * The symbolSpacer prop defines the number of pixels between data + * components and label components. + */ + symbolSpacer?: number; + /** + * The title prop specifies a title to render with the legend. + * This prop should be given as a string, or an array of strings for multi-line titles. + */ + title?: string | string[]; + /** + * The titleComponent prop takes a component instance which will be used to render + * a title for the component. The new element created from the passed + * labelComponent will be supplied with the following properties: x, y, index, data, + * datum, verticalAnchor, textAnchor, style, text, and events. Any of these props + * may be overridden by passing in props to the supplied component, or modified + * or ignored within the custom component itself. If labelComponent is omitted, + * a new VictoryLabel will be created with the props described above. + */ + titleComponent?: React.ReactElement; + /** + * The titleOrientation prop specifies where the a title should be rendered + * in relation to the rest of the legend. Possible values + * for this prop are “top”, “bottom”, “left”, and “right”. + * @default (provided by default theme): titleOrientation="top" + */ + titleOrientation?: OrientationTypes; + /** + * The x and y props define the base position of the legend element. + */ + x?: number; + y?: number; + } + + /** + * VictoryLegend renders a chart legend component. + */ + export class VictoryLegend extends React.Component {} + + type ScatterSymbolType = "circle" | "diamond" | "plus" | "square" | "star" | "triangleDown" | "triangleUp"; + + export interface VictoryScatterProps extends VictoryCommonProps, VictoryDatableProps, VictoryMultiLabeableProps { + /** + * The bubbleProperty prop indicates which property of the data object should be used + * to scale data points in a bubble chart + */ + bubbleProperty?: string; + /** + * The event prop take an array of event objects. Event objects are composed of + * a target, an eventKey, and eventHandlers. Targets may be any valid style namespace + * for a given component, so "data" and "labels" are all valid targets for VictoryScatter + * events. The eventKey may optionally be used to select a single element by index rather than + * an entire set. The eventHandlers object should be given as an object whose keys are standard + * event names (i.e. onClick) and whose values are event callbacks. The return value + * of an event handler is used to modify elemnts. The return value should be given + * as an object or an array of objects with optional target and eventKey keys, + * and a mutation key whose value is a function. The target and eventKey keys + * will default to those corresponding to the element the event handler was attached to. + * The mutation function will be called with the calculated props for the individual selected + * element (i.e. a single bar), and the object returned from the mutation function + * will override the props of the selected element via object assignment. + * @examples + * events={[ + * { + * target: "data", + * eventKey: "thisOne", + * eventHandlers: { + * onClick: () => { + * return [ + * { + * eventKey: "theOtherOne", + * mutation: (props) => { + * return {style: merge({}, props.style, {fill: "orange"})}; + * } + * }, { + * eventKey: "theOtherOne", + * target: "labels", + * mutation: () => { + * return {text: "hey"}; + * } + * } + * ]; + * } + * } + * } + * ]} + */ + events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback>[]; + /** + * Similar to data accessor props `x` and `y`, this prop may be used to functionally + * assign eventKeys to data + */ + eventKey?: StringOrNumberOrCallback; + /** + * The maxBubbleSize prop sets an upper limit for scaling data points in a bubble chart + */ + maxBubbleSize?: number; + /** + * The samples prop specifies how many individual points to plot when plotting + * y as a function of x. Samples is ignored if x props are provided instead. + */ + samples?: number; + /** + * The size prop determines how to scale each data point + */ + size?: number | { (data: any): number }; + /** + * The style prop specifies styles for your VictoryScatter. Any valid inline style properties + * will be applied. Height, width, and padding should be specified via the height, + * width, and padding props, as they are used to calculate the alignment of + * components within chart. In addition to normal style properties, angle and verticalAnchor + * may also be specified via the labels object, and they will be passed as props to + * VictoryLabel, or any custom labelComponent. + * @example {data: {fill: "red"}, labels: {fontSize: 12}} + */ + style?: VictoryStyleInterface; + /** + * The symbol prop determines which symbol should be drawn to represent data points. + */ + symbol?: ScatterSymbolType | { (data: any): ScatterSymbolType }; + } + + /** + * VictoryScatter creates a scatter of points from data. VictoryScatter is a composable component, so it does not include an axis. + * Check out VictoryChart for easy to use scatter plots and more. + */ + export class VictoryScatter extends React.Component {} + + export interface VictoryStackProps extends VictoryCommonProps, VictoryMultiLabeableProps { + /** + * The categories prop specifies how categorical data for a chart should be ordered. + * This prop should be given as an array of string values, or an object with + * these values for x and y. When categories are not given as an object + * When this prop is set on a wrapper component, it will dictate the categories of + * its the children. If this prop is not set, any categories on child component + * or catigorical data, will be merged to create a shared set of categories. + * @example ["dogs", "cats", "mice"] + */ + categories?: CategoryPropType; + /** + * The colorScale prop is an optional prop that defines the color scale the chart's bars + * will be created on. This prop should be given as an array of CSS colors, or as a string + * corresponding to one of the built in color scales. VictoryBar will automatically assign + * values from this color scale to the bars unless colors are explicitly provided in the + * `dataAttributes` prop. + */ + colorScale?: ColorScalePropType; + /** + * The domain prop describes the range of values your chart will include. This prop can be + * given as a array of the minimum and maximum expected values for your chart, + * or as an object that specifies separate arrays for x and y. + * If this prop is not provided, a domain will be calculated from data, or other + * available information. + * @example: [-1, 1], {x: [0, 100], y: [0, 1]} + */ + domain?: DomainPropType; + /** + * The domainPadding prop specifies a number of pixels of padding to add to the + * beginning and end of a domain. This prop is useful for explicitly spacing ticks farther + * from the origin to prevent crowding. This prop should be given as an object with + * numbers specified for x and y. + */ + domainPadding?: DomainPaddingPropType; + /** + * The event prop take an array of event objects. Event objects are composed of + * a childName, target, eventKey, and eventHandlers. Targets may be any valid style namespace + * for a given component, (i.e. "data" and "labels"). The childName will refer to an + * individual child of VictoryStack, either by its name prop, or by index. The eventKey + * may optionally be used to select a single element by index or eventKey rather than + * an entire set. The eventHandlers object should be given as an object whose keys are standard + * event names (i.e. onClick) and whose values are event callbacks. The return value + * of an event handler is used to modify elemnts. The return value should be given + * as an object or an array of objects with optional target and eventKey and childName keys, + * and a mutation key whose value is a function. The target and eventKey and childName keys + * will default to those corresponding to the element the event handler was attached to. + * The mutation function will be called with the calculated props for the individual selected + * element (i.e. a single bar), and the object returned from the mutation function + * will override the props of the selected element via object assignment. + * @examples + * events={[ + * { + * target: "data", + * childName: "firstBar", + * eventHandlers: { + * onClick: () => { + * return [ + * { + * childName: "secondBar", + * mutation: (props) => { + * return {style: merge({}, props.style, {fill: "orange"})}; + * } + * }, { + * childName: "secondBar", + * target: "labels", + * mutation: () => { + * return {text: "hey"}; + * } + * } + * ]; + * } + * } + * } + * ]} + */ + events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback>[]; + /** + * Similar to data accessor props `x` and `y`, this prop may be used to functionally + * assign eventKeys to data + */ + eventKey?: StringOrNumberOrCallback; + /** + * The horizontal prop determines whether the bars will be laid vertically or + * horizontally. The bars will be vertical if this prop is false or unspecified, + * or horizontal if the prop is set to true. + */ + horizontal?: boolean; + /** + * The style prop specifies styles for your grouped chart. These styles will be + * applied to all grouped children + */ + style?: VictoryStyleInterface; + /** + * The xOffset prop is used for grouping stacks of bars. This prop will be set + * by the VictoryGroup component wrapper, or can be set manually. + */ + xOffset?: number; + } + + export class VictoryStack extends React.Component {} + + export interface VictoryPieProps extends VictoryCommonProps, VictoryMultiLabeableProps { + /** + * The colorScale prop is an optional prop that defines the color scale the pie + * will be created on. This prop should be given as an array of CSS colors, or as a string + * corresponding to one of the built in color scales. VictoryPie will automatically assign + * values from this color scale to the pie slices unless colors are explicitly provided in the + * data object + */ + colorScale?: ColorScalePropType; + /** + * The data prop specifies the data to be plotted, + * where data X-value is the slice label (string or number), + * and Y-value is the corresponding number value represented by the slice + * Data should be in the form of an array of data points. + * Each data point may be any format you wish (depending on the `x` and `y` accessor props), + * but by default, an object with x and y properties is expected. + * @example [{x: 1, y: 2}, {x: 2, y: 3}], [[1, 2], [2, 3]], + * [[{x: "a", y: 1}, {x: "b", y: 2}], [{x: "a", y: 2}, {x: "b", y: 3}]] + */ + data?: any[]; + /** + * The dataComponent prop takes an entire, HTML-complete data component which will be used to + * create slices for each datum in the pie chart. The new element created from the passed + * dataComponent will have the property datum set by the pie chart for the point it renders; + * properties style and pathFunction calculated by VictoryPie; an index property set + * corresponding to the location of the datum in the data provided to the pie; events bound to + * the VictoryPie; and the d3 compatible slice object. + * If a dataComponent is not provided, VictoryPie's Slice component will be used. + */ + dataComponent?: React.ReactElement; + /** + * The labelRadius prop defines the radius of the arc that will be used for positioning each slice label. + * If this prop is not set, the label radius will default to the radius of the pie + label padding. + */ + labelRadius?: number; + /** + * The overall end angle of the pie in degrees. This prop is used in conjunction with + * startAngle to create a pie that spans only a segment of a circle. + */ + endAngle?: number; + /** + * The event prop takes an array of event objects. Event objects are composed of + * a target, an eventKey, and eventHandlers. Targets may be any valid style namespace + * for a given component, so "data" and "labels" are all valid targets for VictoryPie + * events. The eventKey may optionally be used to select a single element by index rather than + * an entire set. The eventHandlers object should be given as an object whose keys are standard + * event names (i.e. onClick) and whose values are event callbacks. The return value + * of an event handler is used to modify elemnts. The return value should be given + * as an object or an array of objects with optional target and eventKey keys, + * and a mutation key whose value is a function. The target and eventKey keys + * will default to those corresponding to the element the event handler was attached to. + * The mutation function will be called with the calculated props for the individual selected + * element (i.e. a single bar), and the object returned from the mutation function + * will override the props of the selected element via object assignment. + * @examples + * events={[ + * { + * target: "data", + * eventKey: 1, + * eventHandlers: { + * onClick: () => { + * return [ + * { + * eventKey: 2, + * mutation: (props) => { + * return {style: merge({}, props.style, {fill: "orange"})}; + * } + * }, { + * eventKey: 2, + * target: "labels", + * mutation: () => { + * return {text: "hey"}; + * } + * } + * ]; + * } + * } + * } + * ]} + */ + events?: EventPropTypeInterface<"data" | "labels" | "parent", StringOrNumberOrCallback | string[] | number[]>[]; + /** + * Similar to data accessor props `x` and `y`, this prop may be used to functionally + * assign eventKeys to data + */ + eventKey?: StringOrNumberOrCallback; + /** + * Specifies the radius of the chart. If this property is not provided it is computed + * from width, height, and padding props + * + */ + radius?: number; + /** + * When creating a donut chart, this prop determines the number of pixels between + * the center of the chart and the inner edge of a donut. When this prop is set to zero + * a regular pie chart is rendered. + */ + innerRadius?: number; + /** + * Set the cornerRadius for every dataComponent (Slice by default) within VictoryPie + */ + cornerRadius?: number; + /** + * The padAngle prop determines the amount of separation between adjacent data slices + * in number of degrees + */ + padAngle?: number; + /** + * The overall start angle of the pie in degrees. This prop is used in conjunction with + * endAngle to create a pie that spans only a segment of a circle. + */ + startAngle?: number; + /** + * The style prop specifies styles for your pie. VictoryPie relies on Radium, + * so valid Radium style objects should work for this prop. Height, width, and + * padding should be specified via the height, width, and padding props. + * @example {data: {stroke: "black"}, label: {fontSize: 10}} + */ + style?: VictoryStyleInterface; + /** + * The x prop specifies how to access the X value of each data point. + * If given as a function, it will be run on each data point, and returned value will be used. + * If given as an integer, it will be used as an array index for array-type data points. + * If given as a string, it will be used as a property key for object-type data points. + * If given as an array of strings, or a string containing dots or brackets, + * it will be used as a nested object property path (for details see Lodash docs for _.get). + * If `null` or `undefined`, the data value will be used as is (identity function/pass-through). + * @example 0, 'x', 'x.value.nested.1.thing', 'x[2].also.nested', null, d => Math.sin(d) + */ + x?: DataGetterPropType; + /** + * The y prop specifies how to access the Y value of each data point. + * If given as a function, it will be run on each data point, and returned value will be used. + * If given as an integer, it will be used as an array index for array-type data points. + * If given as a string, it will be used as a property key for object-type data points. + * If given as an array of strings, or a string containing dots or brackets, + * it will be used as a nested object property path (for details see Lodash docs for _.get). + * If `null` or `undefined`, the data value will be used as is (identity function/pass-through). + * @example 0, 'y', 'y.value.nested.1.thing', 'y[2].also.nested', null, d => Math.sin(d) + */ + y?: DataGetterPropType; + } + + /** + * victory-pie draws an SVG pie or donut chart with React. + * Styles and data can be customized by passing in your own values as properties to the component. + * Data changes are animated with VictoryAnimation. + */ + export class VictoryPie extends React.Component {} +} diff --git a/types/victory/victory-tests.tsx b/types/victory/victory-tests.tsx index eb3b7bda40..32c9b3160d 100644 --- a/types/victory/victory-tests.tsx +++ b/types/victory/victory-tests.tsx @@ -197,9 +197,9 @@ test = ( tick.x }, - ticks: { stroke: tick => tick.color }, - tickLabels: { fontSize: tick => tick.y }, + grid: { strokeWidth: (tick: any) => tick.x }, + ticks: { stroke: (tick: any) => tick.color }, + tickLabels: { fontSize: (tick: any) => tick.y }, }} tickValues={[ new Date(1980, 1, 1), @@ -611,8 +611,8 @@ test = ( ]} style={{ data: { - fill: d => d.x, - stroke: (datum, active) => active ? datum.x : datum.y, + fill: (d: any) => d.x, + stroke: (datum: any, active: boolean) => active ? datum.x : datum.y, strokeWidth: 3 } }} @@ -655,19 +655,6 @@ test = ( /> ); -test = ( - (a ? 5 : 3)} - /> -); - // VictoryPie test test = ( ([ + { + eventKey: "theOtherOne", + mutation: props => ({ style: { ...props.style, fill: "orange" } }) + }, + { + eventKey: "theOtherOne", + target: "labels", + mutation: () => ({ text: "hey" }) + } + ]) + } + }]} /> ); diff --git a/types/voucher-code-generator/index.d.ts b/types/voucher-code-generator/index.d.ts new file mode 100644 index 0000000000..7f0cd7efdc --- /dev/null +++ b/types/voucher-code-generator/index.d.ts @@ -0,0 +1,19 @@ +// Type definitions for voucher-code-generator 1.1 +// Project: http://www.voucherify.io/ +// Definitions by: João Moura +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/*~ If this module has methods, declare them as functions like so. + */ +export function charset(name: "numbers" | "alphabetic" | "alphanumeric"): string; +export function generate(config?: generatorConfig): string[]; + +/*~ You can declare types that are available via importing the module */ +export interface generatorConfig { + length?: number; + count?: number; + charset?: string; + prefix?: string; + postfix?: string; + pattern?: string; +} diff --git a/types/voucher-code-generator/tsconfig.json b/types/voucher-code-generator/tsconfig.json new file mode 100644 index 0000000000..dc5d0025be --- /dev/null +++ b/types/voucher-code-generator/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", + "voucher-code-generator-tests.ts" + ] +} diff --git a/types/voucher-code-generator/tslint.json b/types/voucher-code-generator/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/voucher-code-generator/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/voucher-code-generator/voucher-code-generator-tests.ts b/types/voucher-code-generator/voucher-code-generator-tests.ts new file mode 100644 index 0000000000..3232be37aa --- /dev/null +++ b/types/voucher-code-generator/voucher-code-generator-tests.ts @@ -0,0 +1,18 @@ +import voucherGenerator = require('voucher-code-generator'); +import { generatorConfig } from 'voucher-code-generator'; + +const config: generatorConfig = { + length: 6, + count: 3, + charset: "0123456789", + prefix: "offer-", + postfix: "-2019", + pattern: "######" +}; + +voucherGenerator.charset('numbers'); +voucherGenerator.charset('alphabetic'); +voucherGenerator.charset('alphanumeric'); + +voucherGenerator.generate(); +voucherGenerator.generate(config); diff --git a/types/vue-color/index.d.ts b/types/vue-color/index.d.ts index 758d823589..0d59b5965e 100644 --- a/types/vue-color/index.d.ts +++ b/types/vue-color/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for vue-color 2.4 // Project: https://github.com/xiaokaike/vue-color#readme -// Definitions by: My Self +// Definitions by: Clément Flodrops // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 diff --git a/types/vue-scrollto/index.d.ts b/types/vue-scrollto/index.d.ts index 47371283d9..e020d29533 100644 --- a/types/vue-scrollto/index.d.ts +++ b/types/vue-scrollto/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for vue-scrollto 2.7 +// Type definitions for vue-scrollto 2.14 // Project: https://github.com/rigor789/vue-scrollto#readme // Definitions by: Kovács Vince // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -19,13 +19,19 @@ declare namespace VueScrollTo { easing?: string; // The offset that should be applied when scrolling. Default: 0 offset?: number; + // Indicates if scrolling should be performed, even if the scroll target is already in view. Default: true + force?: boolean; // Indicates if user can cancel the scroll or not. Default: true cancelable?: boolean; - // A callback function that should be called when scrolling has ended. Default: noop - onDone?: (() => void) | false; + // A callback function that should be called when scrolling has started. Receives the target element as a + // parameter. Default: noop + onStart?: ((element: Element) => void) | false; + // A callback function that should be called when scrolling has ended. Receives the target element as a + // parameter. Default: noop + onDone?: ((element: Element) => void) | false; // A callback function that should be called when scrolling has been aborted by the user (user scrolled, clicked - // etc.). Default: noop - onCancel?: (() => void) | false; + // etc.). Receives the abort event and the target element as parameters. Default: noop + onCancel?: ((event: Event, element: Element) => void) | false; // Whether or not we want scrolling on the x axis. Default: true x?: boolean; // Whether or not we want scrolling on the y axis. Default: true diff --git a/types/vue-select/index.d.ts b/types/vue-select/index.d.ts index ff8767e189..e022fb65ea 100644 --- a/types/vue-select/index.d.ts +++ b/types/vue-select/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for vue-select 2.4 +// Type definitions for vue-select 2.5 // Project: https://github.com/sagalbot/vue-select#readme // Definitions by: Ilia Beliaev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -14,6 +14,7 @@ export interface VueSelectProps { value: any; options: any[]; disabled: boolean; + clearable: boolean; maxHeight: string; searchable: boolean; multiple: boolean; @@ -22,17 +23,24 @@ export interface VueSelectProps { clearSearchOnSelect: boolean; closeOnSelect: boolean; label: string; + autocomplete: string; + index: string | null; getOptionLabel: (option: any) => string; - onChange: OptionConsumer; + onChange: (val: any) => void; + onInput: (val: any) => void; + onTab: () => void; taggable: boolean; tabindex: number | null; pushTags: boolean; filterable: boolean; + filterBy: (option: any, label: string, search: string) => boolean; + filter: (options: any[], search: string) => boolean; createOption: (option: any) => any; resetOnOptionsChange: boolean; noDrop: boolean; inputId: string | null; dir: string; + selectOnTab: boolean; } export interface VueSelectData { diff --git a/types/vue-select/vue-select-tests.ts b/types/vue-select/vue-select-tests.ts index 8fea33b2dc..6d4b61b2a8 100644 --- a/types/vue-select/vue-select-tests.ts +++ b/types/vue-select/vue-select-tests.ts @@ -31,8 +31,18 @@ new Vue({ optionToOption(option: any) { return option; }, + onValChange(val: any) { + }, + onVoidTab() { + }, onSearch(search: string, loading: (b: boolean) => void) { loading(true); + }, + optionFilterBy(option: any, label: string, search: string) { + return true; + }, + optionsFilter(options: any[], search: string) { + return true; } }, template: ` @@ -40,6 +50,7 @@ new Vue({ :value="value" :options="options" disable="false" + clearable="true" maxHeight="200" searchable="true" multiple="false" @@ -48,16 +59,23 @@ new Vue({ clearSearchOnSelect="false" :closeOnSelect="false" label="name" + autocomplete="off" + :index="null" :getOptionLabel="getOptionLabel" - :onChange="optionConsumer" + :onChange="onValChange" + :onInput="onValChange" + :onTab="onVoidTab" :taggable="true" :tabindex="null" pushTags="false" + :filterBy="optionFilterBy" + :filter="optionsFilter" :createOption="optionToOption" resetOnOptionsChange="false" noDrop="true" :inputId="null" dir="someDir" + selectOnTab="false" @search="onSearch" @input="optionConsumer"> diff --git a/types/webpack-dev-server/index.d.ts b/types/webpack-dev-server/index.d.ts index 30fd2482e7..64c0d81bb7 100644 --- a/types/webpack-dev-server/index.d.ts +++ b/types/webpack-dev-server/index.d.ts @@ -28,7 +28,7 @@ declare namespace WebpackDevServer { type ProxyConfigArrayItem = { path?: string | string[]; - context?: string | string[] + context?: string | string[] | httpProxyMiddleware.Filter } & httpProxyMiddleware.Config; type ProxyConfigArray = ProxyConfigArrayItem[]; @@ -52,11 +52,11 @@ declare namespace WebpackDevServer { interface Configuration { /** Provides the ability to execute custom middleware after all other middleware internally within the server. */ - after?: (app: express.Application) => void; + after?: (app: express.Application, server: WebpackDevServer) => void; /** This option allows you to whitelist services that are allowed to access the dev server. */ allowedHosts?: string[]; /** Provides the ability to execute custom middleware prior to all other middleware internally within the server. */ - before?: (app: express.Application) => void; + before?: (app: express.Application, server: WebpackDevServer) => void; /** This option broadcasts the server via ZeroConf networking on start. */ bonjour?: boolean; /** @@ -150,7 +150,7 @@ declare namespace WebpackDevServer { */ quiet?: boolean; /** @deprecated Here you can access the Express app object and add your own custom middleware to it. */ - setup?: (app: express.Application) => void; + setup?: (app: express.Application, server: WebpackDevServer) => void; /** The Unix socket to listen to (instead of a host). */ socket?: string; /** It is possible to configure advanced options for serving static files from contentBase. */ diff --git a/types/webpack-dev-server/webpack-dev-server-tests.ts b/types/webpack-dev-server/webpack-dev-server-tests.ts index 755245b035..f73d470f10 100644 --- a/types/webpack-dev-server/webpack-dev-server-tests.ts +++ b/types/webpack-dev-server/webpack-dev-server-tests.ts @@ -46,7 +46,7 @@ const config: WebpackDevServer.Configuration = { "**": "http://localhost:9090" }, - setup: (app: Application) => { + setup: (app: Application, server: WebpackDevServer) => { // Here you can access the Express app object and add your own custom middleware to it. // For example, to define custom handlers for some paths: app.get('/some/path', (req, res) => { @@ -87,6 +87,9 @@ const c3: WebpackDevServer.Configuration = { const c4: WebpackDevServer.Configuration = { writeToDisk: (filePath: string) => true, }; +const c5: WebpackDevServer.Configuration = { + proxy: [{context: (pathname: string) => true}] +}; // API example server = new WebpackDevServer(compiler, config); diff --git a/types/webpack-env/index.d.ts b/types/webpack-env/index.d.ts index 705e776c1e..3677523927 100644 --- a/types/webpack-env/index.d.ts +++ b/types/webpack-env/index.d.ts @@ -122,13 +122,13 @@ declare namespace __WebpackModuleApi { * @param dependencies * @param callback */ - accept(dependencies: string[], callback: (updatedDependencies: ModuleId[]) => void): void; + accept(dependencies: string[], callback?: (updatedDependencies: ModuleId[]) => void): void; /** * Accept code updates for the specified dependencies. The callback is called when dependencies were replaced. * @param dependency * @param callback */ - accept(dependency: string, callback: () => void): void; + accept(dependency: string, callback?: () => void): void; /** * Accept code updates for this module without notification of parents. * This should only be used if the module doesn’t export anything. diff --git a/types/webpack-env/webpack-env-tests.ts b/types/webpack-env/webpack-env-tests.ts index 61fb3f6c55..b07a3b632a 100644 --- a/types/webpack-env/webpack-env-tests.ts +++ b/types/webpack-env/webpack-env-tests.ts @@ -19,6 +19,9 @@ require(['./someModule', './otherModule'], (someModule: SomeModule, otherModule: // check if HMR is enabled if(module.hot) { + // accept update of dependency without a callback + module.hot.accept("./handler.js"); + // accept update of dependency module.hot.accept("./handler.js", function() { //... diff --git a/types/yup/index.d.ts b/types/yup/index.d.ts index 58067b926b..f29fe60d23 100644 --- a/types/yup/index.d.ts +++ b/types/yup/index.d.ts @@ -296,7 +296,7 @@ export interface SchemaDescription { type: string; label: string; meta: object; - tests: string[]; + tests: Array<{ name: string, params: object }>; fields: object; } diff --git a/types/yup/yup-tests.ts b/types/yup/yup-tests.ts index 0c515ef78c..152fdd25e4 100644 --- a/types/yup/yup-tests.ts +++ b/types/yup/yup-tests.ts @@ -420,7 +420,7 @@ const description: SchemaDescription = { type: "type", label: "label", meta: { key: "value" }, - tests: ["test1", "test2"], + tests: [{ name: "test1", params: {} }, { name: "test2", params: {} }], fields: { key: "value" } }; diff --git a/types/zapier-platform-core/index.d.ts b/types/zapier-platform-core/index.d.ts deleted file mode 100644 index ec9f3de919..0000000000 --- a/types/zapier-platform-core/index.d.ts +++ /dev/null @@ -1,119 +0,0 @@ -// Type definitions for zapier-platform-core 3.1 -// Project: https://github.com/zapier/zapier-platform-core, https://zapier.com -// Definitions by: Bradley Ayers -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 - -/// - -import * as http from "http"; - -export function createAppHandler(appRawOrPath: object | string): (event: any, context: any, callback: any) => void; -export function createAppTester(appRawOrPath: object | string): Promise; -export function integrationTestHandler(event: any, context: any, callback: any): any; -export const version: string; - -export interface HttpRequestOptions { - url?: string; - method?: "POST" | "GET" | "OPTIONS" | "HEAD" | "DELETE" | "PATCH" | "PUT"; - body?: string | Buffer | NodeJS.ReadableStream | object | null; - headers?: { [name: string]: string }; - json?: object | any[] | null; - params?: object; - form?: object | null; - raw?: boolean; - redirect?: "manual" | "error" | "follow"; - follow?: number; - compress?: boolean; - agent?: http.Agent | null; - timeout?: number; - size?: number; -} - -export interface HttpResponse { - status: number; - content: string | Buffer; - json: object | undefined | Promise; - body?: NodeJS.ReadableStream; - headers: { [key: string]: string }; - getHeader(key: string): string | undefined; - throwForStatus(): void; - request: HttpRequestOptions; -} - -export class HaltedError extends Error {} -export class ExpiredAuthError extends Error {} -export class RefreshAuthError extends Error {} - -export interface Z { - request(options: HttpRequestOptions): Promise; - request(url: string, options?: HttpRequestOptions): Promise; - JSON: typeof JSON; - console: Console; - hash(alg: string, data: string): any; - errors: { - RefreshAuthError: { - new (message?: string): HaltedError; - new (message?: string): ExpiredAuthError; - new (message?: string): RefreshAuthError; - }; - }; - stashFile: (promise: Promise, knownLength?: number | string, filename?: string, contentType?: string) => Promise; - dehydrate: (callback: (z: Z, bundle: Bundle) => any, inputData: T) => string; -} - -export interface AuthData { - access_token: string; - refresh_token?: string; -} - -export interface Bundle { - authData: AuthData; - inputData: InputData; -} - -export interface AuthorizeUrlBundle { - inputData: InputData; -} - -export interface GetAccessTokenBundle { - inputData: InputData & { - code: string; - }; -} - -export interface RefreshAccessTokenBundle { - inputData: InputData; - authData: AuthData; -} - -export interface OAuth2Authentication { - type: "oauth2"; - connectionLabel: string; - oauth2Config: { - authorizeUrl: - | string - | (( - z: Z, - bundle: AuthorizeUrlBundle - ) => string | Promise) - | HttpRequestOptions; - getAccessToken: - | (( - z: Z, - bundle: GetAccessTokenBundle - ) => AuthData | Promise) - | HttpRequestOptions; - refreshAccessToken?: - | (( - z: Z, - bundle: RefreshAccessTokenBundle - ) => AuthData | Promise) - | HttpRequestOptions; - autoRefresh: boolean; - scope?: string; - }; - test: - | ((z: Z, bundle: Bundle) => boolean | Promise) - | { url: string }; -} diff --git a/types/zapier-platform-core/tsconfig.json b/types/zapier-platform-core/tsconfig.json deleted file mode 100644 index c197914893..0000000000 --- a/types/zapier-platform-core/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", - "zapier-platform-core-tests.ts" - ] -} \ No newline at end of file diff --git a/types/zapier-platform-core/zapier-platform-core-tests.ts b/types/zapier-platform-core/zapier-platform-core-tests.ts deleted file mode 100644 index 6c6c490edd..0000000000 --- a/types/zapier-platform-core/zapier-platform-core-tests.ts +++ /dev/null @@ -1,100 +0,0 @@ -import * as zapier from "zapier-platform-core"; - -const BASE_URL = "http://example.com"; -const OAUTH2_CLIENT_ID = "12345"; -const OAUTH2_CLIENT_SECRET = "abcdef"; - -const authentication: zapier.OAuth2Authentication = { - type: "oauth2", - connectionLabel: "User account", - oauth2Config: { - authorizeUrl: `${BASE_URL}/oauth2/authorize`, - - getAccessToken: async (z, bundle) => { - const response = await z.request(`${BASE_URL}/oauth2/access`, { - method: "POST", - body: { - code: bundle.inputData.code, - client_id: OAUTH2_CLIENT_ID, - client_secret: OAUTH2_CLIENT_SECRET, - grant_type: "authorization_code" - } - }); - - if (response.status !== 200) { - throw new Error( - "Unable to fetch access token: " + response.content - ); - } - - if (typeof response.content !== "string") { - throw new Error( - `Unable to response content, expected string but got ${typeof response.content}.` - ); - } - - const result = z.JSON.parse(response.content); - return { - access_token: result.access_token, - refresh_token: result.refresh_token - }; - }, - - refreshAccessToken: async (z, bundle) => { - if (!bundle.authData.refresh_token) { - throw new Error( - "Required `bundle.authData.refresh_token` field missing." - ); - } - - const response = await z.request(`${BASE_URL}/oauth2/refresh`, { - method: "POST", - body: { - refresh_token: bundle.authData.refresh_token, - client_id: OAUTH2_CLIENT_ID, - client_secret: OAUTH2_CLIENT_SECRET, - grant_type: "refresh_token" - } - }); - - if (response.status !== 200) { - throw new Error( - "Unable to fetch access token: " + response.content - ); - } - - if (typeof response.content !== "string") { - throw new Error( - `Unable to response content, expected string but got ${typeof response.content}.` - ); - } - - const result = z.JSON.parse(response.content); - return { - access_token: result.access_token, - refresh_token: bundle.authData.refresh_token - }; - }, - - autoRefresh: true, - - scope: "read,write" - }, - - test: async z => { - const response = await z.request(`${BASE_URL}/oauth2/test`); - - if (response.status === 401) { - throw new Error("The access token you supplied is not valid"); - } - - return true; - } -}; - -zapier.version; - -const testCreateAppTester = async () => { - const zapierApp = {}; - const appTester = await zapier.createAppTester(zapierApp); -}; diff --git a/types/zeromq/index.d.ts b/types/zeromq/index.d.ts index d1088aba8f..e40e5cc3aa 100644 --- a/types/zeromq/index.d.ts +++ b/types/zeromq/index.d.ts @@ -58,21 +58,79 @@ export interface SocketOptions { zap_domain: number; } -export class Socket { +/** + * Export all option names at the global level + */ +export const ZMQ_HWM: number; +export const ZMQ_SWAP: number; +export const ZMQ_AFFINITY: number; +export const ZMQ_IDENTITY: number; +export const ZMQ_SUBSCRIBE: number; +export const ZMQ_UNSUBSCRIBE: number; +export const ZMQ_RATE: number; +export const ZMQ_RECOVERY_IVL: number; +export const ZMQ_MCAST_LOOP: number; +export const ZMQ_SNDBUF: number; +export const ZMQ_RCVBUF: number; +export const ZMQ_RCVMORE: number; +export const ZMQ_FD: number; +export const ZMQ_EVENTS: number; +export const ZMQ_TYPE: number; +export const ZMQ_LINGER: number; +export const ZMQ_RECONNECT_IVL: number; +export const ZMQ_BACKLOG: number; +export const ZMQ_RECOVERY_IVL_MSEC: number; +export const ZMQ_RECONNECT_IVL_MAX: number; +export const ZMQ_MAXMSGSIZE: number; +export const ZMQ_SNDHWM: number; +export const ZMQ_RCVHWM: number; +export const ZMQ_MULTICAST_HOPS: number; +export const ZMQ_RCVTIMEO: number; +export const ZMQ_SNDTIMEO: number; +export const ZMQ_IPV4ONLY: number; +export const ZMQ_LAST_ENDPOINT: number; +export const ZMQ_ROUTER_MANDATORY: number; +export const ZMQ_TCP_KEEPALIVE: number; +export const ZMQ_TCP_KEEPALIVE_CNT: number; +export const ZMQ_TCP_KEEPALIVE_IDLE: number; +export const ZMQ_TCP_KEEPALIVE_INTVL: number; +export const ZMQ_TCP_ACCEPT_FILTER: number; +export const ZMQ_DELAY_ATTACH_ON_CONNECT: number; +export const ZMQ_XPUB_VERBOSE: number; +export const ZMQ_ROUTER_RAW: number; +export const ZMQ_IPV6: number; +export const ZMQ_MECHANISM: number; +export const ZMQ_PLAIN_SERVER: number; +export const ZMQ_PLAIN_USERNAME: number; +export const ZMQ_PLAIN_PASSWORD: number; +export const ZMQ_CURVE_SERVER: number; +export const ZMQ_CURVE_PUBLICKEY: number; +export const ZMQ_CURVE_SECRETKEY: number; +export const ZMQ_CURVE_SERVERKEY: number; +export const ZMQ_ZAP_DOMAIN: number; +export const ZMQ_HEARTBEAT_IVL: number; +export const ZMQ_HEARTBEAT_TTL: number; +export const ZMQ_HEARTBEAT_TIMEOUT: number; +export const ZMQ_CONNECT_TIMEOUT: number; +export const ZMQ_IO_THREADS: number; +export const ZMQ_MAX_SOCKETS: number; +export const ZMQ_ROUTER_HANDOVER: number; + +export class Socket extends NodeJS.EventEmitter { /** * Set `opt` to `val`. * * @param opt Option * @param val Value */ - setsocketopt(opt: number|string, val: any): Socket; + setsockopt(opt: number|string, val: any): Socket; /** * Get socket `opt`. * * @param opt Option number */ - getsocketopt(opt: number|string): any; + getsockopt(opt: number|string): any; /** * Async bind. @@ -156,17 +214,20 @@ export class Socket { */ monitor(interval?: number, numOfEvents?: number): Socket; + /** + * Disable monitoring of a Socket release idle handler + * and close the socket + * + * @return for chaining + */ + unmonitor(): Socket; + /** * Close the socket. * */ close(): Socket; - /** - * Socket event - 'message' - */ - on(eventName: string, callback: (...buffer: Buffer[]) => void): void; - pause(): void; resume(): void;