diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 8ce8955c37..ec7763f89a 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,5 +1,4 @@ /types/abbrev/ @BendingBender -/types/ably/ @ably /types/abs/ @AyaMorisawa /types/absolute/ @AyaMorisawa /types/acc-wizard/ @cyrilschumacher @@ -14,8 +13,11 @@ /types/activex-access/ @zspitz /types/activex-adodb/ @zspitz /types/activex-dao/ @zspitz +/types/activex-diskquota/ @zspitz /types/activex-excel/ @zspitz +/types/activex-faxcomexlib/ @zspitz /types/activex-infopath/ @zspitz +/types/activex-iwshruntimelibrary/ @zspitz /types/activex-libreoffice/ @zspitz /types/activex-msforms/ @zspitz /types/activex-mshtml/ @zspitz @@ -24,6 +26,8 @@ /types/activex-outlook/ @zspitz /types/activex-powerpoint/ @zspitz /types/activex-scripting/ @zspitz +/types/activex-shdocvw/ @zspitz +/types/activex-shell/ @zspitz /types/activex-stdole/ @zspitz /types/activex-vbide/ @zspitz /types/activex-wia/ @zspitz @@ -36,7 +40,7 @@ /types/agenda/ @meirgottlieb /types/aggregate-error/ @BendingBender /types/alertify/ @jjeffery -/types/alexa-sdk/ @petebeegle @hoo29 @pascalwhoop @blforce @rk-7 +/types/alexa-sdk/ @petebeegle @hoo29 @pascalwhoop @blforce @rk-7 @alexmalcoci /types/alexa-voice-service/ @dolanmiu /types/algebra.js/ @CaselIT /types/algoliasearch/ @cbaptiste @haroenv @aherve @@ -49,7 +53,7 @@ /types/amqp/ @seikho @jonnysparkplugs /types/amqp-rpc/ @wokim /types/amqplib/ @mnahkies @abreits @nfantone -/types/analytics-node/ @fongandrew +/types/analytics-node/ @fongandrew @thomasthiebaud /types/angular/ @diegovilar @thorn0 @calebstdenis @leonard-thieu /types/angular-agility/ @rolandzwaga /types/angular-animate/ @michelsalib @adidahiya @rasch @codyschaaf @@ -136,12 +140,14 @@ /types/api-error-handler/ @tkrotoff /types/apigee-access/ @CasperSkydt /types/apollo-codegen/ @bradleyayers +/types/app-root-dir/ @chenyang-biu /types/app-root-path/ @shantmarouti /types/appdmg/ @unindented /types/appframework/ @kyo-ago /types/applepayjs/ @martincostello /types/appletvjs/ @brainded /types/applicationinsights-js/ @kamilszostak +/types/aqb/ @Athenkosi-Mase /types/arbiter/ @arash16 /types/arcgis-js-api/v3/ @Esri /types/arcgis-js-api/ @Esri @@ -167,15 +173,16 @@ /types/aspnet-identity-pw/ @jt000 /types/assert-equal-jsx/ @seryl /types/assert-plus/ @KostyaTretyak -/types/assertion-error/ @Bartvds /types/assertsharp/ @brunolm /types/assets-webpack-plugin/ @kryops /types/async/ @borisyankov @kern0 @Penryn @fenying @pascalmartin /types/async-cache/ @BendingBender -/types/async-lock/ @elisee +/types/async-lock/ @elisee @afharo @rhymmor /types/async-polling/ @Goldsmith42 +/types/async-retry/ @albertywu /types/async.nexttick/ @pyrho /types/asynciterator/ @rubensworks +/types/atlaskit__button/ @dijimsta /types/atmosphere.js/ @toedter @Mory1879 /types/atom/ @GlenCFL @smhxx @lierdakil /types/atom-keymap/ @GlenCFL @@ -186,7 +193,7 @@ /types/auth0-angular/ @homesar /types/auth0-js/v7/ @advancedrei /types/auth0-js/ @adrianchia @mdurrant @peterblazejewicz -/types/auth0-lock/ @carusology @goldcaddy77 +/types/auth0-lock/ @carusology @goldcaddy77 @lfaudreejr /types/auth0.widget/ @advancedrei /types/auto-launch/ @rhysd @unindented /types/auto-sni/ @janwo @@ -194,10 +201,11 @@ /types/autolinker/ @leonyu /types/autoprefixer/ @odnamrataizem /types/autosize/ @kingdango @keika299 @NeekSandhu +/types/autosuggest-highlight/ @senukartur /types/awesomplete/ @webbiesdk @bmdixon @tbekolay /types/aws-iot-device-sdk/ @niik @mlamp -/types/aws-lambda/ @skarum @tobyhede @buggy @y13i @wwwy3y3 @OrthoDex @MichaelMarner @daniel-cottone @kostya-misura @coderbyheart -/types/aws-serverless-express/ @threesquared @jcaffey @mattmeye +/types/aws-lambda/ @skarum @tobyhede @buggy @y13i @wwwy3y3 @OrthoDex @MichaelMarner @daniel-cottone @kostya-misura @coderbyheart @palmithor @daniloraisi @simonbuchan @Haydabase +/types/aws-serverless-express/ @threesquared @jcaffey @mattmeye @albertovasquez /types/aws4/ @ajcrites /types/axel/ @ruslan-molodyko /types/azure/ @AndrewGaspar @antiveeranna @SomaticIT @@ -237,6 +245,7 @@ /types/base-x/ @chrootsu /types/base16/ @alechill /types/base64-js/ @pe8ter +/types/base64topdf/ @lucasriondel /types/bases/ @harikv /types/bash-glob/ @mrmlnc /types/basic-auth/ @moonpyk @vesse @@ -267,6 +276,7 @@ /types/bip39/ @micksatana /types/bit-array/ @mudkipme /types/bitcoinjs-lib/ @mhegazy @dlebrecht @rbuckton @micksatana @youssefgh +/types/bitcore-lib/ @lautarodragan /types/bittorrent-protocol/ @feross @tlaziuk /types/bitwise-xor/ @rogierschouten /types/bl/ @Bartvds @@ -295,8 +305,10 @@ /types/bootbox/ @vbortone @konpikwastaken @kanup @icereed @trodi @stannynuytkens @renjfk /types/bootpag/ @rdeneau /types/bootstrap/ @borisyankov +/types/bootstrap-3-typeahead/ @AndersonFriaca /types/bootstrap-datepicker/ @borisyankov /types/bootstrap-fileinput/ @CheCoxshall +/types/bootstrap-growl-ifightcrime/ @AndersonFriaca /types/bootstrap-maxlength/ @danmana /types/bootstrap-notify/ @niemyjski @mouse0270 @robert-voica /types/bootstrap-select/ @LKay @@ -334,8 +346,9 @@ /types/buffer-equal/ @Bartvds /types/buffers/ @rhencke /types/bufferstream/ @Bartvds +/types/builtin-modules/ @ajafff /types/bull/v2/ @bgrieder @JProgrammer -/types/bull/ @bgrieder @JProgrammer @marshall007 @weeco +/types/bull/ @bgrieder @JProgrammer @marshall007 @weeco @blaugold /types/bump-regex/ @silkentrance /types/bunnymq/ @cyrilschumacher /types/bunyan/ @amikhalev @@ -351,27 +364,31 @@ /types/byline/ @reppners /types/bytebuffer/ @cappellin /types/bytes/ @danny8002 -/types/c3/ @mcliment @gerinjacob @denyo +/types/c3/ @mcliment @gerinjacob @denyo @dmitryshindin /types/cache-manager/ @GausSim /types/cal-heatmap/ @RetroChrisB /types/callsite/ @newclear /types/callsites/ @BendingBender /types/calq/ @eirikhm +/types/camaro/ @tuananh /types/camelcase/ @samverschueren /types/camelcase-keys/ @mhegazy /types/camo/ @lucasmciruzzi /types/cancan/ @Vincent-Pang /types/cannon/ @clark-stevenson @Gelio +/types/canvas-confetti/ @matracey /types/canvas-gauges/ @Mikhus /types/canvasjs/ @brutalimp /types/capitalize/ @frederickfogerty /types/card-validator/ @ChanceM /types/case-sensitive-paths-webpack-plugin/ @r3nya -/types/caseless/ @downace +/types/caseless/ @downace @mastermatt /types/cash/ @akvlko /types/casperjs/ @jedmao @urielch /types/cassandra-driver/ @Svjard -/types/catbox/ @jasonswearingen @AJamesPhillips +/types/catalog/ @grossbart @wereHamster +/types/catbox/v7/ @jasonswearingen @AJamesPhillips +/types/catbox/ @jasonswearingen @AJamesPhillips @saboya /types/cbor/ @pushplay /types/ccap/ @taoqf /types/chai/v2/ @Bartvds @AGBrown @@ -382,7 +399,7 @@ /types/chai-dom/ @mattlewis92 /types/chai-enzyme/ @asvetliakov /types/chai-fuzzy/ @Bartvds -/types/chai-http/ @Nemo157 @G1itcher @CaselIT +/types/chai-http/ @Nemo157 @G1itcher @CaselIT @bas-l /types/chai-jest-snapshot/ @mattvperry /types/chai-jquery/ @kazimanzurrashid /types/chai-json-schema/ @ulrichheiniger @@ -395,7 +412,8 @@ /types/chance/ @cbowdon @brikou /types/change-emitter/ @iskandersierra /types/charm/ @Xananax -/types/chart.js/ @anuti @FabienLavocat @KentarouTakeda @larrybahr @mernen @josefpaij @danmana +/types/charset/ @cspotcode +/types/chart.js/ @anuti @FabienLavocat @KentarouTakeda @larrybahr @mernen @josefpaij @danmana @guillaume-ro-fr @chicoxyzzy /types/chartist/ @mtgibbs @psimonski @clottman /types/chayns/ @HenningKuehl /types/check-sum/ @BendingBender @@ -403,6 +421,7 @@ /types/checkstyle-formatter/ @mhegazy /types/checksum/ @rogierschouten /types/cheerio/ @blittle @wmaurer @umarniz @LiJinyao +/types/chessboardjs/ @sliverb @davidmpaz /types/chmodr/ @BendingBender /types/chokidar/ @reppners @felixfbecker @bayssmekanique /types/chosen-js/ @borisyankov @denisname @@ -420,7 +439,7 @@ /types/clean-stack/ @BendingBender /types/clean-webpack-plugin/ @j-f1 /types/clear-require/ @dan-j -/types/cleave.js/ @clentfort @jasongi-at-sportsbet +/types/cleave.js/ @clentfort @jasongi-at-sportsbet @sashashakun /types/cli/ @kayahr /types/cli-color/ @ChaosinaCan /types/cli-spinner/ @janslow @@ -449,9 +468,11 @@ /types/collections/ @scarabedore /types/color/v0/ @LKay /types/color/v1/ @LKay -/types/color/ @Airlun +/types/color/v2/ @Airlun +/types/color/ @Airlun @jameswlane /types/color-convert/ @Airlun /types/color-name/ @Ailrun +/types/color-namer/ @in19farkt /types/color-string/ @BendingBender @danmarshall /types/colorbrewer/ @mtraynham /types/colors/ @Bartvds @staeke @@ -479,7 +500,7 @@ /types/conf/v0/ @SamVerschueren /types/conf/ @SamVerschueren @BendingBender /types/confidence/ @jppellerin -/types/config/ @RWander @forrestbice @jndonald3 +/types/config/ @RWander @forrestbice @jndonald3 @albertovasquez /types/configstore/ @ArcticLight /types/confit/ @ethanresnick /types/connect/ @SomaticIT @@ -561,6 +582,7 @@ /types/cron/ @horiuchi /types/cropperjs/ @stepancar /types/croppie/ @connor4312 @dklmuc @sarunint +/types/cross-spawn/ @Alorel /types/crossfilter/ @schmuli @iebaker @nordfjord /types/crossroads/ @diullei /types/cryptiles/ @awendland @@ -579,6 +601,7 @@ /types/csvrow/ @codeanimal /types/csvtojson/ @EricByers @wcarson /types/cucumber/v1/ @abraaoalves @jan-molak @isoung @BendingBender +/types/cucumber/v3/ @abraaoalves @jan-molak @isoung @BendingBender @ErikSchierboom /types/cucumber/ @abraaoalves @jan-molak @isoung @BendingBender @ErikSchierboom /types/currency-formatter/ @mhegazy @davidmpaz /types/custom-error-generator/ @thmiceli @@ -586,8 +609,9 @@ /types/cwise-compiler/ @taoqf /types/cwise-parser/ @taoqf /types/cybozulabs-md5/ @pine613 -/types/cytoscape/ @phreed @wy193777 @ypconstante +/types/cytoscape/ @phreed @wy193777 @ypconstante @janniclas /types/d3/v3/ @gustavderdrache @borisyankov @MatthiasJobst +/types/d3/v4/ @tomwanzek @gustavderdrache @borisyankov /types/d3/ @tomwanzek @gustavderdrache @borisyankov /types/d3-array/ @gustavderdrache @borisyankov @tomwanzek /types/d3-axis/ @tomwanzek @gustavderdrache @borisyankov @@ -601,6 +625,7 @@ /types/d3-drag/ @tomwanzek @gustavderdrache @borisyankov /types/d3-dsv/ @tomwanzek @gustavderdrache @borisyankov /types/d3-ease/ @tomwanzek @gustavderdrache @borisyankov +/types/d3-fetch/ @ledragon /types/d3-force/ @tomwanzek @gustavderdrache @borisyankov /types/d3-format/ @tomwanzek @gustavderdrache @borisyankov /types/d3-geo/ @Ledragon @tomwanzek @gustavderdrache @borisyankov @@ -615,6 +640,7 @@ /types/d3-random/ @tomwanzek @gustavderdrache @borisyankov /types/d3-request/ @Ledragon @gustavderdrache @borisyankov @tomwanzek /types/d3-sankey/ @tomwanzek @gustavderdrache +/types/d3-scale/v1/ @tomwanzek @gustavderdrache @borisyankov /types/d3-scale/ @tomwanzek @gustavderdrache @borisyankov /types/d3-scale-chromatic/ @Ledragon @gustavderdrache @borisyankov @henriquefm /types/d3-selection/ @tomwanzek @gustavderdrache @borisyankov @@ -635,12 +661,14 @@ /types/dagre-d3/ @markwongsk /types/dagre-layout/ @qinfchen @Frankrike @vilterp /types/dargs/ @BendingBender -/types/dat-gui/ @gyohk @sonic3d @rroylance +/types/dashify/ @rokt33r +/types/dat.gui/ @gyohk @sonic3d @rroylance /types/data-driven/ @mrhen /types/datadog-metrics/ @pushplay /types/datatables.net/ @Silver-Connection @omidkrad @pragmatrix @CNBoland /types/datatables.net-buttons/ @Silver-Connection @SammyG4Free @jimhartford /types/datatables.net-fixedheader/ @szechyjs @Silver-Connection +/types/datatables.net-rowgroup/ @maixiu /types/datatables.net-rowreorder/ @baywet /types/datatables.net-select/ @szechyjs /types/date-arithmetic/ @HeeL @@ -659,6 +687,7 @@ /types/decamelize/ @samverschueren /types/decay/ @enaeseth /types/decompress/ @plantain-00 +/types/decompress-response/ @DanielRosenwasser /types/decorum/ @dflor003 /types/dedent/ @douglasduteil /types/deep-assign/ @souldreamer @@ -706,7 +735,7 @@ /types/discontinuous-range/ @OiCMudkips /types/disposable-email-domains/ @geoffreak /types/doccookies/ @jonegerton -/types/dockerode/ @seikho @nlaplante @isac322 @lazarusx @meisenzahl +/types/dockerode/ @seikho @nlaplante @isac322 @lazarusx @meisenzahl @thegecko /types/docopt/ @giggio /types/doctrine/ @rictic /types/documentdb/ @NoelAbrahams @brettferdosi @ctstone @yifanwu @@ -761,6 +790,7 @@ /types/dynatable/ @francoismassart /types/dynogels/ @SpartanLabs /types/each/ @misak113 +/types/earcut/ @NaridaL /types/easeljs/ @evilangelist /types/easy-api-request/ @DeadAlready /types/easy-jsend/ @DeadAlready @@ -772,6 +802,7 @@ /types/echarts/ @xieisabug @AntiMoron /types/ecurve/ @mhegazy /types/ed25519/ @erikma +/types/ed2curve/ @ffflorian /types/egg-mock/ @sheperdwind /types/egg.js/ @ToastHawaii /types/egjs__axes/ @naver @@ -788,11 +819,11 @@ /types/electron-json-storage/ @stpettersens @nrlquaker @jbw91 /types/electron-notifications/ @djpereira /types/electron-notify/ @djpereira -/types/electron-packager/ @SomaticIT @cortopy +/types/electron-packager/ @SomaticIT @cortopy @jkleinsc /types/electron-settings/v2/ @leonard-thieu /types/electron-settings/ @icopp @nrlquaker /types/electron-spellchecker/ @unindented -/types/electron-store/ @unindented +/types/electron-store/ @unindented @jsynowiec /types/electron-util/ @kputh /types/electron-window-state/ @rhysd /types/electron-winstaller/ @shiftkey @unindented @@ -803,7 +834,7 @@ /types/email-templates/ @cyrilschumacher @gurisko @blankstar85 /types/ember/v1/ @jedmao /types/ember/ @jedmao @bttf @dwickern @chriskrycho @theroncross @mfeckie -/types/ember-data/ @dwickern @mike-north +/types/ember-data/ @dwickern @mike-north @chriskrycho /types/ember-feature-flags/ @tansongyang /types/ember-mocha/ @dwickern /types/ember-modal-dialog/ @tansongyang @@ -827,6 +858,7 @@ /types/envify/ @tkQubo /types/enzyme/ @MarianPalkus @NoHomey @jwbay @huhuanming @MartynasZilinskas @thovden /types/enzyme-adapter-react-15/ @tkrotoff +/types/enzyme-adapter-react-15.4/ @nali /types/enzyme-adapter-react-16/ @tkrotoff /types/enzyme-to-json/ @joscha /types/eonasdan-bootstrap-datetimepicker/ @ToastHawaii @@ -836,14 +868,17 @@ /types/eq.js/ @stephenlautier /types/errorhandler/ @santialbo /types/es6-collections/ @rbuckton -/types/es6-promisify/ @harryshipton +/types/es6-promisify/ @harryshipton @bschlenk /types/es6-shim/ @rbuckton /types/es6-weak-map/ @pine /types/escape-html/ @elisee /types/escape-latex/ @olsio /types/escape-string-regexp/ @kruncher @faergeek /types/escodegen/ @simondel +/types/eslint/ @pmdartus @j-f1 /types/eslint-plugin-prettier/ @ikatyang +/types/eslint-scope/ @mysticatea +/types/eslint-visitor-keys/ @mysticatea /types/esprima/v2/ @teppeis @RReverser /types/esprima/ @teppeis @RReverser @peter-scott /types/esprima-walk/ @tswaters @@ -872,8 +907,9 @@ /types/expect.js/ @teppeis /types/expectations/ @vvakame /types/expo/v23/ @KonstantinKai -/types/expo/ @KonstantinKai @martynaskadisa -/types/expr-eval/ @connor4312 +/types/expo/v24/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger +/types/expo/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger +/types/expo__vector-icons/ @incleaf /types/express/ @borisyankov /types/express-brute/ @cyrilschumacher /types/express-brute-memcached/ @cyrilschumacher @@ -889,7 +925,7 @@ /types/express-flash-2/ @mathsalmi /types/express-flash-notification/ @Mister4Eyes /types/express-formidable/ @tdolsen @evanshortiss -/types/express-graphql/ @isman-usoh @nitintutlani @hubel +/types/express-graphql/ @isman-usoh @nitintutlani @hubel @zya /types/express-handlebars/ @stpettersens @yhaskell /types/express-jwt/ @wokim @kacepe @Sl1MBoy /types/express-less/ @xieyubo @@ -905,8 +941,9 @@ /types/express-rate-limit/ @cyrilschumacher @makepost /types/express-route-fs/ @kripod /types/express-sanitized/ @cjbarth -/types/express-serve-static-core/ @borisyankov @19majkel94 @kacepe @micksatana -/types/express-session/ @horiuchi @jacobbogers +/types/express-serve-static-core/ @borisyankov @19majkel94 @kacepe @micksatana @samijaber +/types/express-session/ @horiuchi @jacobbogers @builtinnya @ry7n +/types/express-to-koa/ @xiaohanzhang /types/express-unless/ @wokim /types/express-winston/ @bricka /types/extend/ @reppners @@ -916,7 +953,7 @@ /types/extract-zip/ @mizunashi-mana /types/eyes/ @brynbellomy /types/f1/ @neolwc -/types/fabric/ @oklemencic @joewashear007 @mrand01 +/types/fabric/ @oklemencic @joewashear007 @mrand01 @NotWoods /types/facebook-js-sdk/ @amritk /types/facebook-pixel/ @noctishsu /types/faker/v3/ @Kuniwak @@ -939,6 +976,22 @@ /types/fb/ @JoshStrobl /types/fbemitter/ @kmxz /types/featherlight/ @xStrom +/types/feathersjs__authentication/ @AbraaoAlves @j2L4e +/types/feathersjs__authentication-client/ @AbraaoAlves @j2L4e +/types/feathersjs__authentication-jwt/ @j2L4e +/types/feathersjs__authentication-local/ @j2L4e +/types/feathersjs__authentication-oauth1/ @j2L4e +/types/feathersjs__authentication-oauth2/ @j2L4e +/types/feathersjs__configuration/ @j2L4e +/types/feathersjs__errors/ @j2L4e +/types/feathersjs__express/ @j2L4e +/types/feathersjs__feathers/ @j2L4e @AbraaoAlves +/types/feathersjs__primus/ @j2L4e +/types/feathersjs__primus-client/ @j2L4e +/types/feathersjs__rest-client/ @j2L4e +/types/feathersjs__socket-commons/ @j2L4e +/types/feathersjs__socketio/ @j2L4e +/types/feathersjs__socketio-client/ @j2L4e /types/feedme/ @codeanimal /types/feedparser/ @cortopy /types/fetch-jsonp/ @tkrotoff @@ -954,11 +1007,12 @@ /types/file-type/ @tcaesvk @BendingBender /types/file-url/ @coderslagoon /types/filenamify/ @rokt33r -/types/filesize/ @GiedriusGrabauskas +/types/filesize/ @GiedriusGrabauskas @renchap /types/fill-pdf/ @westy92 /types/finalhandler/ @chrootsu /types/finch/ @DavidSichau /types/find/ @andypyrope +/types/find-root/ @Alorel /types/find-up/ @BendingBender /types/findup-sync/ @Bartvds @ngbrown /types/fingerprintjs/ @zaneli @@ -986,6 +1040,7 @@ /types/fm-websync/ @markusmauch /types/fontfaceobserver/ @RandScullard /types/fontoxml/ @rolandzwaga +/types/forever-agent/ @yavanosta /types/forever-monitor/ @shuntksh /types/forge-di/ @adamcarr /types/form-data/ @soywiz @leonyu @BendingBender @@ -995,6 +1050,7 @@ /types/format-io/ @amitbeck /types/format-unicorn/ @kruncher /types/formidable/ @Nemo157 +/types/forms/ @suXinjke /types/forwarded/ @BendingBender /types/fossil-delta/ @endel /types/foundation/ @borisyankov @@ -1028,12 +1084,11 @@ /types/ftpd/ @rogierschouten /types/fullname/ @kayahr /types/fullpage.js/ @jodiwarren -/types/fuse/ @smrq /types/fusioncharts/ @rohitkr @shivarajkv /types/fuzzaldrin/ @mhegazy /types/fuzzaldrin-plus/ @jeancroy @jkillian -/types/fuzzyset/ @lgrignon -/types/fuzzyset.js/ @lgrignon +/types/fuzzyset/ @lgrignon @narainsagar +/types/fuzzyset.js/ @lgrignon @narainsagar /types/fxn/ @charrondev /types/gae.channel.api/ @vvakame /types/gamequery/ @Laubi @@ -1176,6 +1231,7 @@ /types/gapi.youtube/ @sgtfrankieboy /types/gapi.youtubeanalytics/ @sgtfrankieboy /types/gaussian/ @scttcper +/types/geetest/ @plantain-00 /types/gen-readlines/ @CodeAnimal /types/generic-functions/ @stpettersens /types/generic-pool/ @jerray @@ -1186,9 +1242,12 @@ /types/geokdbush/ @DenisCarriere /types/geometry-dom/ @nakakura /types/geopattern/ @Gaelan +/types/get-caller-file/ @ajafff /types/get-node-dimensions/ @vincekovacs /types/get-stdin/ @DanielRosenwasser /types/get-stream/ @douglasduteil @BendingBender +/types/get-value/ @DanielRosenwasser +/types/getopts/ @azasypkin /types/getos/ @BendingBender /types/gettext.js/ @jucrouzet /types/gifffer/ @gatimus @@ -1238,9 +1297,11 @@ /types/graceful-fs/ @Bartvds @BendingBender /types/graham_scan/ @hberntsen /types/graphite-udp/ @EricByers -/types/graphql/ @TonyPythoneer @calebmer @intellix @firede @kepennar @freiksenet @IvanGoncharov @DxCx @rportugal +/types/graphql/ @TonyPythoneer @calebmer @intellix @firede @kepennar @freiksenet @IvanGoncharov @DxCx @rportugal @tgriesser @dyst5422 @adnsio /types/graphql-date/ @enaeseth +/types/graphql-iso-date/ @jwaldrip /types/graphql-relay/ @arvitaly @nitintutlani @Grelinfo +/types/graphql-resolve-batch/ @nayni /types/graphql-type-json/ @schfkt /types/graphviz/ @mhfrantz /types/grasp/ @agnoster @@ -1250,10 +1311,11 @@ /types/grecaptcha/v0/ @brentj73 /types/grecaptcha/ @DethAriel /types/gregorian-calendar/ @cwalv +/types/grid-styled/ @antonvasin /types/gridfs-stream/ @liorm /types/gridstack/ @PascalSenn @ZoolWay @Sl1MBoy /types/grunt/ @jeffmay @basarat -/types/gsap/ @codebelt @ProbablePrime +/types/gsap/ @codebelt @ProbablePrime @philipbulley /types/guid/ @maroy1986 /types/gulp/ @GiedriusGrabauskas /types/gulp-angular-templatecache/ @amanmahajan7 @@ -1331,7 +1393,8 @@ /types/hapi/v8/ @jasonswearingen /types/hapi/v12/ @jasonswearingen /types/hapi/v15/ @jasonswearingen -/types/hapi/ @jasonswearingen @AJamesPhillips +/types/hapi/v16/ @jasonswearingen @AJamesPhillips +/types/hapi/ @BorntraegerMarc @rafaelsouzaf @jhsimms /types/hapi-auth-basic/ @AJamesPhillips @saboya /types/hapi-auth-jwt2/ @warrenseymour /types/hapi-decorators/ @kenhowardpdx @@ -1346,13 +1409,14 @@ /types/hashids/ @pocesar /types/hashmap/ @outring /types/haversine/ @screendriver +/types/hbs/ @davidm77 /types/he/ @sedwards2009 /types/headroom/ @hakubo /types/heap/ @ryan10132 /types/heapdump/ @weekens /types/heatmap.js/ @lookuptable @rhys-vdw /types/hedron/ @dborysov -/types/hellojs/ @PavelPZ @vuorinem +/types/hellojs/ @PavelPZ @vuorinem @baywet /types/hellosign-embedded/ @xt0rted /types/helmet/ @cyrilschumacher @EvanHahn @bluehatbrit /types/heredatalens/ @denyo @@ -1395,7 +1459,7 @@ /types/http-codes/ @mhegazy /types/http-context/ @mtraynham /types/http-errors/ @tkrotoff @BendingBender -/types/http-proxy/ @SomaticIT +/types/http-proxy/ @SomaticIT @Raigen /types/http-proxy-agent/ @mrmlnc /types/http-proxy-middleware/ @zebMcCorkle @BendingBender /types/http-server/ @plantain-00 @@ -1406,6 +1470,7 @@ /types/hubspot-pace/ @borislavjivkov /types/humane/ @jmvrbanac /types/humanize-plus/ @DenisCarriere +/types/humanize-string/ @ragnarok56 /types/humanparser/ @MichalPodeszwa /types/humps/ @nikeee /types/hyco-ws/ @mrcabellom @@ -1443,12 +1508,12 @@ /types/imap/ @psnider /types/imap-simple/ @pushplay /types/imgur-rest-api/ @lukewestby -/types/immutability-helper/ @seansfkelley /types/impress/ @borisyankov /types/in-range/ @DanielRosenwasser /types/incremental-dom/ @basarat @lanthaler @vvakame /types/indent-string/ @mhegazy -/types/inert/ @nycdotnet @AJamesPhillips +/types/inert/v4/ @nycdotnet @AJamesPhillips +/types/inert/ @nycdotnet @AJamesPhillips @lenovouser /types/inflected/ @dsci /types/inflection/ @shiwano /types/inherits/ @chrootsu @@ -1477,6 +1542,7 @@ /types/iota.lib.js/ @fogsh /types/ip/ @codeanimal /types/ip-regex/ @unindented +/types/ipcheck/ @bengry /types/irc/ @phillips1012 /types/iron/ @simonschick @rafaelsouzaf /types/is/ @cabralRodrigo @@ -1488,6 +1554,7 @@ /types/is-compressed/ @mhegazy /types/is-finite/ @mhegazy /types/is-glob/ @mrmlnc +/types/is-hotkey/ @petester42 /types/is-ip/ @coderslagoon /types/is-my-json-valid/ @kruncher /types/is-negated-glob/ @ajafff @@ -1508,6 +1575,7 @@ /types/is-windows/ @mizunashi-mana /types/isbn-utils/ @elhaard /types/iscroll/ @csrakowski +/types/ismobilejs/ @Ty3uK /types/iso-3166-2/ @sicilica /types/iso8601-localizer/ @avielfedida /types/isomorphic-fetch/ @toddlucas @@ -1525,7 +1593,7 @@ /types/jade/ @panuhorsmalahti /types/jalaali-js/ @alitaheri /types/japanese-holidays/ @syamatoo -/types/jasmine/ @borisyankov @theodorejb @davidparsson @gmoothart @lukas-zech-software +/types/jasmine/ @borisyankov @theodorejb @davidparsson @gmoothart @lukas-zech-software @Engineer2B /types/jasmine-ajax/ @lgrignon /types/jasmine-data_driven_tests/ @AnthonyMacKinnon /types/jasmine-enzyme/ @bolatovumar @@ -1549,7 +1617,7 @@ /types/jdataview/ @RReverser /types/jdenticon/ @mtr /types/jest/v16/ @NoHomey @jwbay -/types/jest/ @NoHomey @jwbay @asvetliakov @alexjoverm @epicallan @ikatyang @wsmd @JamieMason @douglasduteil +/types/jest/ @NoHomey @jwbay @asvetliakov @alexjoverm @epicallan @ikatyang @wsmd @JamieMason @douglasduteil @AhnpGit /types/jest-diff/ @myabc /types/jest-docblock/ @ikatyang /types/jest-get-type/ @myabc @@ -1562,11 +1630,12 @@ /types/jjv/ @Nemo157 /types/jjve/ @Nemo157 /types/jmespath/ @pushplay -/types/johnny-five/ @nakakura +/types/johnny-five/ @nakakura @ujvzolee @workshop2 /types/joi/v6/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW /types/joi/v10/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW @GaelMagnan @ralekna @schfkt @rokoroku -/types/joi/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW @GaelMagnan @ralekna @schfkt @rokoroku @dankraus +/types/joi/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW @GaelMagnan @ralekna @schfkt @rokoroku @dankraus @wanganjun /types/joigoose/ @boothwhack +/types/josa/ @vichyssoise /types/jpeg-js/ @DanielRosenwasser /types/jpm/ @github-account-because-they-want-it /types/jqgrid/ @lokeshpeta @@ -1576,7 +1645,9 @@ /types/jquery/ @leonard-thieu @borisyankov @choffmeister @Steve-Fenton @Diullei @tasoili @jasons-novaleaf @seanski @Guuz @ksummerlin @basarat @nwolverson @derekcicerone @AndrewGaspar @seikichi @benjaminjackman @s093294 @JoshStrobl @johnnyreilly @DickvdBrink @King2500 /types/jquery-ajax-chain/ @humana-fragilitas /types/jquery-alertable/ @stever +/types/jquery-awesome-cursor/ @zskovacs /types/jquery-backstretch/ @dkulyk +/types/jquery-countdown/ @AndersonFriaca /types/jquery-cropbox/ @PerKastman /types/jquery-deparam/ @patsissons /types/jquery-easy-loading/ @delphinus35 @@ -1587,7 +1658,9 @@ /types/jquery-jcrop/ @joeskeen /types/jquery-jsonrpcclient/ @Ty3uK /types/jquery-knob/ @iain8 -/types/jquery-mask-plugin/ @avidenic +/types/jquery-lazyload/ @AndersonFriaca +/types/jquery-mask-plugin/ @avidenic @AndersonFriaca +/types/jquery-maskmoney/ @AndersonFriaca /types/jquery-match-height/ @kbytesys /types/jquery-mockjax/ @laszlojakab @vladeck /types/jquery-mousewheel/ @xt0rted @@ -1595,6 +1668,8 @@ /types/jquery-param/ @patsissons /types/jquery-sortable/ @Seltzer /types/jquery-steps/ @jblank @nickwph +/types/jquery-sticky/ @maixiu +/types/jquery-tags-input/ @AndersonFriaca /types/jquery-timeentry/ @marknadig /types/jquery-toastmessage-plugin/ @joeskeen /types/jquery-truncate-html/ @abraaoalves @@ -1649,6 +1724,7 @@ /types/jquery.slimscroll/ @Promact /types/jquery.soap/ @tigerxy /types/jquery.sortelements/ @tbureck +/types/jquery.stickem/ @davidmpaz /types/jquery.superlink/ @niemyjski /types/jquery.tagsmanager/ @vbortone /types/jquery.tile/ @zaneli @@ -1679,6 +1755,7 @@ /types/js-quantities/ @wrummler /types/js-schema/ @marcinporebski @roblabat /types/js-search/ @guoyunhe +/types/js-sha512/ @nicojs /types/js-to-java/ @skyitachi /types/js-url/ @pine613 /types/js-yaml/ @Bartvds @sclausen @@ -1696,7 +1773,9 @@ /types/jshamcrest/ @dharkness /types/jsmockito/ @shiver-me-timbers /types/jsnox/ @stkb @DovydasNavickas +/types/json-js/ @NN--- /types/json-merge-patch/ @senyaarseniy +/types/json-parse-better-errors/ @DanielRosenwasser /types/json-patch/ @vvakame /types/json-pointer/ @Bartvds /types/json-query/ @mtraynham @@ -1714,12 +1793,14 @@ /types/jsonnet/ @hookclaw /types/jsonp/ @surenkov /types/jsonpath/ @horiuchi @ikatyang -/types/jsonrpc-serializer/ @Akim95 +/types/jsonrpc-serializer/ @Akim95 @many20 /types/jsonstream/ @Bartvds +/types/jsontoxml/ @benstevens48 /types/jsonwebtoken/ @SomaticIT @danielheim @brikou /types/jspdf/ @amberjs /types/jsqrcode/ @lordazzi /types/jsrender/ @zakki +/types/jsreport-core/ @taoqf /types/jsrp/ @harryshipton /types/jss/ @appsforartists @kof /types/jssha/ @randombk @SrTobi @@ -1737,7 +1818,7 @@ /types/jui-core/ @easylogic /types/jui-grid/ @easylogic /types/jweixin/ @taoqf @gomydodo -/types/jwplayer/ @martinduparc @kutomer +/types/jwplayer/ @martinduparc @kutomer @philippguertler /types/jws/ @JustinBeckwith /types/jwt-client/ @timoteoponce /types/jwt-decode/v1/ @QuatroDevOfficial @@ -1767,6 +1848,7 @@ /types/klaw/v1/ @mceachen /types/klaw/ @mceachen /types/klaw-sync/ @shiftkey +/types/kms-json/ @sunnyone /types/knex/ @tkQubo @baronfel @MeLlamoPablo @mastermatt @micksatana /types/knex-postgis/ @vesse /types/knockback/ @borisyankov @@ -1807,7 +1889,8 @@ /types/koa-logger/ @geoffreak @tlaziuk /types/koa-logger-winston/ @stevehipwell /types/koa-morgan/ @vesse -/types/koa-mount/ @amirsaber +/types/koa-mount/ @amirsaber @tlaziuk +/types/koa-multer/ @benstevens48 /types/koa-passport/ @horiuchi @tlaziuk @brendtumi /types/koa-pino-logger/ @khell /types/koa-pug/ @Xstoudi @@ -1816,7 +1899,7 @@ /types/koa-route/ @migstopheles /types/koa-router/ @hellopao @schfkt /types/koa-send/ @pe8ter @tlaziuk -/types/koa-session/ @kerol2r20 +/types/koa-session/ @kerol2r20 @tlaziuk /types/koa-session-minimal/ @longztian /types/koa-sslify/ @wingsbob /types/koa-static/ @hellopao @tlaziuk @@ -1855,6 +1938,7 @@ /types/leaflet-gpx/ @soucekv /types/leaflet-imageoverlay-rotated/ @tkleinke /types/leaflet-label/ @Nemo157 +/types/leaflet-mouse-position/ @Hanyon /types/leaflet-polylinedecorator/ @soucekv /types/leaflet-providers/ @BendingBender /types/leaflet-rotatedmarker/ @robert-prib-polestar @@ -1866,7 +1950,6 @@ /types/leaflet.locatecontrol/ @DenisCarriere /types/leaflet.markercluster/ @rimig /types/leaflet.markercluster.layersupport/ @AsamK -/types/leaflet.mouseposition/ @Hanyon /types/leaflet.pancontrol/ @Brictarus /types/leaflet.pm/ @tkleinke /types/leaflet.polylinemeasure/ @RiON69 @@ -1890,7 +1973,6 @@ /types/line-by-line/ @etomsen /types/line-reader/ @stpettersens /types/linkify-it/ @praxxis -/types/linq4js/ @morrisjdev /types/lls/ @borislavjivkov /types/load-json-file/ @SamVerschueren /types/loader-runner/ @e-cloud @@ -1898,7 +1980,6 @@ /types/loadware/ @ALyman /types/lobibox/ @itboy87 /types/local-dynamo/ @Sicilica -/types/localforage-cordovasqlitedriver/ @thgreasi /types/localized-countries/ @coderslagoon /types/localizejs-library/ @salbahra /types/locate-path/ @me @@ -1907,7 +1988,7 @@ /types/lockr/ @droritos /types/locutus/ @hookclaw /types/lodash/v3/ @bczengel @chrootsu -/types/lodash/ @bczengel @chrootsu @stepancar @ericanderson @aj-r @ailrun @e-cloud @thorn0 @jtmthf +/types/lodash/ @bczengel @chrootsu @stepancar @aj-r @ailrun @e-cloud @thorn0 @jtmthf @DomiR /types/lodash-es/ @stephenlautier @e-cloud /types/lodash-webpack-plugin/ @bumbleblym /types/lodash.add/ @bczengel @chrootsu @stepancar @@ -2197,11 +2278,12 @@ /types/log-symbols/ @BendingBender /types/log-update/ @BendingBender /types/logat/ @krvikash35 +/types/logform/ @DABH /types/logg/ @blittle /types/loggly/ @rmartone @geoffreak /types/loglevel/ @Pro @szmeti @screendriver /types/logrotate-stream/ @rogierschouten -/types/lokijs/ @TeamworkGuy2 +/types/lokijs/ @TeamworkGuy2 @thomasconner /types/lolex/ @Nemo157 @joshuakgoldberg @rogierschouten /types/long/ @peterkooijmans /types/loopback/ @kattsushi @enko @sequoia @drmikecrowe @@ -2220,7 +2302,7 @@ /types/lunr/v0/ @sebastian-lenz /types/lunr/ @seantanly /types/lusca/ @crutchcorn -/types/luxon/ @colbydehart @FourwingsY +/types/luxon/ @colbydehart @FourwingsY @jsiebern /types/lwip/ @AyaMorisawa /types/lz-string/ @M0ns1gn0r /types/magic-number/ @stpettersens @@ -2255,15 +2337,36 @@ /types/massive/v3/ @swissspidy @clarenceh /types/massive/ @swissspidy @clarenceh @AmazingTurtle /types/match-media-mock/ @asvetliakov +/types/material-components-web/ @BrentDouglas /types/material-design-lite/ @bradzacher /types/material-ui/ @ngbrown @theigor @alitaheri @herrmanno @DaIgeb @allienna @schlesingermatthias @InsidersByte @artyomsv @dan-j @minodisk /types/material-ui-datatables/ @coding2012 -/types/materialize-css/v0/ @eriklieben @leonyu @SinghSukhdeep @jfcere @scote +/types/material__animation/ @BrentDouglas +/types/material__auto-init/ @BrentDouglas +/types/material__base/ @BrentDouglas +/types/material__checkbox/ @BrentDouglas +/types/material__dialog/ @BrentDouglas +/types/material__drawer/ @BrentDouglas +/types/material__form-field/ @BrentDouglas +/types/material__grid-list/ @BrentDouglas +/types/material__icon-toggle/ @BrentDouglas +/types/material__linear-progress/ @BrentDouglas +/types/material__menu/ @BrentDouglas +/types/material__radio/ @BrentDouglas +/types/material__ripple/ @BrentDouglas +/types/material__select/ @BrentDouglas +/types/material__selection-control/ @BrentDouglas +/types/material__slider/ @BrentDouglas +/types/material__snackbar/ @BrentDouglas +/types/material__tabs/ @BrentDouglas +/types/material__textfield/ @BrentDouglas +/types/material__toolbar/ @BrentDouglas +/types/materialize-css/v0/ @eriklieben @leonyu @SinghSukhdeep @jfcere @scote @LiadIdan /types/materialize-css/ @huww98 /types/math3d/ @laszlojakab @jimsmart /types/mathjax/ @rolandzwaga /types/mathjs/ @siavol -/types/matter-js/ @piranha771 +/types/matter-js/ @piranha771 @hasparus /types/maxmind/ @geoffreak /types/mcustomscrollbar/ @flurg /types/md5/ @arcdev1 @jprogrammer @@ -2277,10 +2380,11 @@ /types/memory-cache/ @jedigo @thieman /types/memory-fs/ @e-cloud /types/memwatch-next/ @cyrilschumacher -/types/meow/ @KnisterPeter +/types/meow/ @KnisterPeter @praxxis /types/merge-descriptors/ @danny8002 /types/merge-stream/ @k-kagurazaka @daniel-zazula /types/merge2/ @tkrotoff @smac89 +/types/merkle/ @kerol2r20 /types/mersenne-twister/ @KentarouTakeda /types/meshblu/ @fnipo /types/mess/ @Nemo157 @@ -2315,6 +2419,7 @@ /types/minimatch/ @vvakame @shantmarouti /types/minimist/ @Bartvds @Necroskillz @kamranayub /types/minimist-options/ @ikatyang +/types/minio/ @barinbritva /types/minipass/ @BendingBender /types/mirrorx/ @aaronphy /types/mithril/ @spacejack @andraaspar @isiahmeadows @@ -2326,7 +2431,9 @@ /types/mkpath/ @optical /types/mobx-apollo/ @pselden /types/mocha/ @kazimanzurrashid @otiai10 @jt000 @enlight +/types/mocha-each/ @magnostherobot /types/mocha-phantomjs/ @ErikSchierboom +/types/mocha-steps/ @Arylo /types/mochaccino/ @thomas-p /types/mock-aws-s3/ @bluehatbrit /types/mock-fs/ @Nemo157 @tkqubo @@ -2340,15 +2447,18 @@ /types/moji/ @yasupeke /types/moment-business/ @wonbyte /types/moment-business-time/ @swist -/types/moment-duration-format/ @SwintDC @TwoStone @leonard-thieu +/types/moment-duration-format/ @SwintDC @TwoStone @leonard-thieu @bendykowski /types/moment-holiday/ @rwdalpe /types/moment-jalaali/ @alitaheri /types/moment-range/ @Burgov @wilgert @franjuan @MartynasZilinskas /types/moment-round/ @jacobbaskin /types/moment-strftime2/ @dex4er /types/moment-timezone/ @michelsalib @alanblins +/types/mongo-sanitize/ @CedricCazin +/types/mongodb/v2/ @CaselIT @alanmarcell @kikar @bitjson @dante-101 @mcortesi /types/mongodb/ @CaselIT @alanmarcell @kikar @bitjson @dante-101 @mcortesi -/types/mongoose/ @simonxca @horiuchi @sindrenm @lukasz-zak +/types/mongoose/v4/ @simonxca @horiuchi @sindrenm @lukasz-zak +/types/mongoose/ @simonxca @horiuchi @sindrenm @lukasz-zak @Alorel @jendrikw @ethanresnick /types/mongoose-auto-increment/ @AyaMorisawa /types/mongoose-deep-populate/ @AyaMorisawa /types/mongoose-geojson-schema/ @bondz @@ -2367,6 +2477,7 @@ /types/move-concurrently/ @mgroenhoff /types/moviedb/ @basarat @0x6368656174 /types/moxios/ @itoasuka +/types/mozilla-readability/ @charlesvdv /types/mpromise/ @sgkim126 /types/mri/ @shiftkey @j-f1 /types/ms/ @danny8002 @@ -2385,7 +2496,7 @@ /types/multiparty/ @kenfdev /types/multiplexjs/ @KamyarNazeri /types/multisort/ @CzBuCHi -/types/multistream/ @mrmlnc +/types/multistream/ @mrmlnc @kenzierocks /types/murmurhash-js/ @cvle /types/murmurhash3js/ @dlee-nvisia /types/musicmetadata/ @Xstoudi @@ -2396,6 +2507,7 @@ /types/n3/ @phreed /types/nano/ @timjacobi @vincekovacs /types/nanoajax/ @nathancahill +/types/nanoid/ @bash /types/nanomsg/ @titan /types/nanoscroller/ @zihark17 /types/nanp/ @karn @@ -2405,7 +2517,7 @@ /types/natural-sort/ @a-morales /types/navigation/ @grahammendick /types/navigation-react/ @grahammendick -/types/navigo/ @aersamkull +/types/navigo/ @aersamkull @dancespiele /types/nblas/ @erikgerrits /types/nconf/ @jedigo @jmthibault /types/ncp/ @bartvds @@ -2421,6 +2533,9 @@ /types/nes/ @NoHomey @saboya /types/net-keepalive/ @hertzg /types/netmask/ @mhfrantz +/types/new-relic-browser/ @renehamburger @piotrkubisa +/types/newline-remove/ @OpenByteDev +/types/newrelic/ @mastermatt /types/nexpect/ @vvakame /types/next/ @dru89 @brikou /types/next-redux-wrapper/ @stevegeek @@ -2447,19 +2562,20 @@ /types/nightmare/ @horiuchi @samyang-au /types/nightwatch/ @rkavalap @schlesiger /types/noble/ @swook @wind-rider @shantanubhadoria @lukel99 @bioball @keton -/types/nock/ @bonnici @horiuchi @afharo @mastermatt +/types/nock/ @bonnici @horiuchi @afharo @mastermatt @damour /types/nodal/ @charrondev /types/node/v4/ @eps1lon -/types/node/v6/ @WilcoBakker @inlined @eps1lon +/types/node/v6/ @WilcoBakker @inlined @eps1lon @Alorel /types/node/v7/ @parambirs @tellnes @WilcoBakker @eps1lon -/types/node/v8/ @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @OliverJAsh @eps1lon @Hannes-Magnusson-CK @jkomyno -/types/node/ @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @OliverJAsh @eps1lon @Hannes-Magnusson-CK @jkomyno @ajafff +/types/node/v8/ @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @OliverJAsh @eps1lon @Hannes-Magnusson-CK @jkomyno @hoo29 +/types/node/ @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @OliverJAsh @eps1lon @Hannes-Magnusson-CK @jkomyno @ajafff @hoo29 /types/node-7z/ @erkie /types/node-array-ext/ @Beng89 /types/node-cache/ @chrootsu @dthunell @useltmann /types/node-calendar/ @luzianz /types/node-cleanup/ @agadar /types/node-common-errors/ @icopp +/types/node-cron/ @maximelkin /types/node-dir/ @panuhorsmalahti /types/node-dogstatsd/ @chrisbobo /types/node-emoji/ @jonestristand @styu @@ -2478,7 +2594,6 @@ /types/node-json-db/ @kuzn-ilya /types/node-mysql-wrapper/ @kataras /types/node-notifier/ @tkQubo -/types/node-pg-migrate/ @bradleyayers /types/node-polyglot/ @timjk /types/node-powershell/ @rodrigoff /types/node-ral/ @ssddi456 @@ -2494,7 +2609,6 @@ /types/node-uuid/ @jeffmay /types/node-validator/ @kengorab /types/node-vault/ @YuJianrong -/types/node-waves/ @stephenlautier /types/node-wit/ @julienduf /types/node-xmpp-client/ @PJakcson /types/node-xmpp-core/ @PJakcson @@ -2527,6 +2641,7 @@ /types/novnc-core/ @smithkl42 @BendingBender /types/npm/ @SomaticIT /types/npm-package-arg/ @mgroenhoff +/types/npm-packlist/ @ajafff /types/ns-api/ @Archcry /types/nslog/ @unindented /types/nsqjs/ @cezaryrk @@ -2549,6 +2664,7 @@ /types/object-hash/ @misak113 /types/object-inspect/ @demurgos /types/object-map/ @wolfgang42 +/types/object-merge/ @OpenByteDev /types/object-path/ @pocesar /types/object-refs/ @3fd /types/oblo-util/ @Oblosys @@ -2557,10 +2673,11 @@ /types/oclazyload/ @rolandzwaga /types/odata/ @janhommes @jcchalte /types/ofe/ @Morfent -/types/office-js/ @OfficeDev @LanceEA +/types/office-js/ @OfficeDev @LanceEA @Zlatkovsky @kbrandl @Rick-Kirkham /types/offline-js/ @cgwrench /types/oibackoff/ @geoffreak /types/oidc-token-manager/ @rosieks +/types/ol/ @yairtawil /types/on-finished/ @czechboy0 @BendingBender /types/on-headers/ @jjeffery @BendingBender /types/once/ @denis-sokolov @BendingBender @@ -2574,16 +2691,16 @@ /types/openjscad/ @danmarshall /types/openlayers/v2/ @bolhovsky /types/openlayers/v3/ @osechet @matthiasdailey-ccri -/types/openlayers/ @osechet @wb14123 @ailrun @mylen @iamthechad @danmana +/types/openlayers/ @osechet @wb14123 @ailrun @mylen @iamthechad @danmana @yairtawil @pierremarc /types/openstack-wrapper/ @sanjaymadane /types/opentok/ @westy92 @CatGuardian -/types/opentype.js/ @danmarshall +/types/opentype.js/ @danmarshall @edzis /types/opn/ @shinnn @SomaticIT @tlent /types/optics-agent/ @crevil /types/optimist/ @soywiz @chbrown /types/optimize-css-assets-webpack-plugin/ @odnamrataizem /types/ora/v0/ @screendriver -/types/ora/ @basarat @screendriver @BendingBender +/types/ora/ @basarat @screendriver @BendingBender @azasypkin /types/oracledb/ @Bigous /types/orchestrator/ @tkQubo @TeamworkGuy2 /types/orderedmap/ @bradleyayers @@ -2593,7 +2710,7 @@ /types/os-locale/ @AyaMorisawa @BendingBender /types/os-name/ @BendingBender /types/os-tmpdir/ @mhegazy -/types/osmosis/ @jurajkocan +/types/osmosis/ @jurajkocan @evanshortiss /types/osmtogeojson/ @tkqubo /types/osrm/ @DenisCarriere /types/otplib/ @renjfk @@ -2611,6 +2728,7 @@ /types/p-every/ @BendingBender /types/p-lazy/ @BendingBender /types/p-limit/ @BendingBender +/types/p-loading/ @renjfk /types/p-locate/ @BendingBender /types/p-log/ @BendingBender /types/p-map/ @BendingBender @@ -2641,7 +2759,10 @@ /types/paper/ @clark-stevenson @Xakaloz /types/paralleljs/ @jbaldwin /types/parent-package-json/ @sgmccli -/types/parse/ @dpoetzsch @jaeggerr @flavionegrao +/types/parity-pmd/ @leovujanic @jewbre +/types/parity-pmr/ @leovujanic +/types/parity-poe/ @leovujanic +/types/parse/ @dpoetzsch @jaeggerr @flavionegrao @wesleygrimes /types/parse-git-config/ @leonard-thieu /types/parse-glob/ @glen-84 /types/parse-json/ @mrmlnc @@ -2653,7 +2774,7 @@ /types/parse-unit/ @Jack-Works /types/parseurl/ @bomret /types/parsimmon/ @Bartvds @mizunashi-mana @bcherny @bvanreeven @leonard-thieu -/types/passport/ @horiuchi @enaeseth @theigor @tlaziuk +/types/passport/ @horiuchi @enaeseth @theigor @tlaziuk @danielpa9708 /types/passport-anonymous/ @0x6368656174 /types/passport-beam/ @AtlasDev /types/passport-discord/ @kzay @@ -2663,10 +2784,13 @@ /types/passport-github2/ @yasupeke @mthmulders /types/passport-google-oauth/ @staticfunction /types/passport-google-oauth2/ @bluehatbrit -/types/passport-http/ @krizalys +/types/passport-http/ @krizalys @tlaziuk @cjbarth /types/passport-http-bearer/ @isman-usoh +/types/passport-jwt/ @jindev +/types/passport-kakao/ @Park9eon /types/passport-local/ @SomaticIT /types/passport-local-mongoose/ @linusbrolin +/types/passport-naver/ @Park9eon /types/passport-oauth2/ @pasieronen /types/passport-oauth2-client-password/ @akaNightmare /types/passport-saml/ @cjbarth @@ -2741,7 +2865,7 @@ /types/playcanvas/ @Neoflash1979 /types/playerframework/ @ricardosabino /types/pleasejs/ @nakakura -/types/plotly.js/ @chrisgervang @martinduparc @frederikaalund @taoqf +/types/plotly.js/ @chrisgervang @martinduparc @frederikaalund @taoqf @Dadstart /types/plugapi/ @BNedry /types/plugin-error/ @rogierschouten /types/plupload/ @patrickbussmann @@ -2802,6 +2926,7 @@ /types/promise-pg/ @coldacid /types/promise-polyfill/ @skysteve /types/promise-pool/ @vilic +/types/promise-queue/ @LachlanStuart /types/promise-retry/ @shirakaba /types/promise.prototype.finally/ @slavik57 @BendingBender /types/promised-temp/ @rokadias @@ -2820,7 +2945,7 @@ /types/prosemirror-keymap/ @bradleyayers @davidka @timjb /types/prosemirror-markdown/ @bradleyayers @davidka @timjb /types/prosemirror-menu/ @bradleyayers @davidka @timjb -/types/prosemirror-model/ @bradleyayers @davidka @timjb +/types/prosemirror-model/ @bradleyayers @davidka @timjb @neknalb /types/prosemirror-schema-basic/ @bradleyayers @davidka @timjb /types/prosemirror-schema-list/ @bradleyayers @davidka @timjb /types/prosemirror-state/ @bradleyayers @davidka @timjb @@ -2835,18 +2960,19 @@ /types/proxyquire/ @jt000 /types/pty.js/ @enlight /types/public-ip/ @BendingBender -/types/pubnub/ @bitbankinc @rollymaduk +/types/pubnub/ @bitbankinc @rollymaduk @vitosamson /types/pubsub-js/ @borisyankov /types/pug/ @TonyPythoneer @19majkel94 -/types/pulltorefreshjs/ @DanielRosenwasser +/types/pulltorefreshjs/ @DanielRosenwasser @humpedli /types/pump/ @tlaziuk /types/pupa/ @nju33 -/types/puppeteer/ @marvinhagemeister @cdeutsch +/types/puppeteer/v0/ @marvinhagemeister @cdeutsch +/types/puppeteer/ @marvinhagemeister @cdeutsch @jwbay /types/pure-render-decorator/ @seansfkelley /types/purl/ @danfma /types/pusher-js/ @tkqubo /types/pvutils/ @microshine -/types/python-shell/ @dolanmiu +/types/python-shell/ @dolanmiu @WORMSS /types/q/v0/ @bnemetchek @johnnyreilly /types/q/ @bnemetchek @AndrewGaspar @johnnyreilly @mboudreau /types/q-io/ @Bartvds @@ -2859,7 +2985,7 @@ /types/qrcode.react/ @mleko /types/qs/ @RWander @leonyu @tehbelinda @zyml @artursvonda @CarlosBonetti /types/qtip2/ @Seltzer @leonard-thieu -/types/query-string/ @SamVerschueren @tkrotoff @huhuanming +/types/query-string/ @SamVerschueren @tkrotoff @huhuanming @MadaraUchiha /types/quick-lru/ @BendingBender /types/quill/ @sumitkm @guillaume-ro-fr @43081j /types/quixote/ @greybax @@ -2871,8 +2997,9 @@ /types/rabbit.js/ @wokim /types/radium/ @alexgorbatchev @nupplaphil @asvetliakov @mihe /types/radius/ @codeanimal -/types/ramda/ @donnut @mdekrey @mrdziuban @sbking @afharo @teves-castro @1M0reBug @hojberg @charlespwd @samsonkeung @angeloocana @raynerd @googol @moshensky +/types/ramda/ @donnut @mdekrey @mrdziuban @sbking @afharo @teves-castro @1M0reBug @hojberg @charlespwd @samsonkeung @angeloocana @raynerd @googol @moshensky @ethanresnick /types/random-js/ @pistacchio +/types/random-number/ @OpenByteDev /types/random-seed/ @endel /types/random-string/ @stpettersens /types/randomcolor/ @feitzi @BradyLiles @@ -2882,7 +3009,14 @@ /types/rappid/ @DenEwout /types/raspi/ @nebrius /types/raspi-board/ @nebrius +/types/raspi-gpio/ @nebrius +/types/raspi-i2c/ @nebrius +/types/raspi-led/ @nebrius +/types/raspi-onewire/ @nebrius /types/raspi-peripheral/ @nebrius +/types/raspi-pwm/ @nebrius +/types/raspi-serial/ @nebrius +/types/raspi-soft-pwm/ @nebrius /types/ratelimiter/ @AyaMorisawa /types/raty/ @terrawheat /types/raven/ @scttcper @1999 @@ -2904,13 +3038,14 @@ /types/react-aria-menubutton/ @forabi @crohlfs /types/react-autosuggest/ @nicolas-schmitt @pjo256 @robessog @tbayne @cdeutsch @rosskevin /types/react-beautiful-dnd/ @varHarrie @bradleyayers +/types/react-big-calendar/ @piotrwitek @paustint @pikpok /types/react-body-classname/ @mhegazy /types/react-bootstrap/ @walkerburgin @vsiao @danilojrr @Batbold-Gansukh @octatone @chengsieuly @mretolaza @katbusch @vitosamson @LKay @aaronbeall /types/react-bootstrap-date-picker/ @LKay @ssi-hu-antal-bodnar /types/react-bootstrap-daterangepicker/ @ianks /types/react-bootstrap-table/v2/ @flaub @alelode @UJosue10 /types/react-bootstrap-table/ @flaub @alelode @UJosue10 @dawnmist @Ogglas -/types/react-bootstrap-typeahead/ @Guymestef +/types/react-bootstrap-typeahead/ @Guymestef @radziksh /types/react-breadcrumbs/ @KostyaEsmukov /types/react-breadcrumbs-dynamic/ @mitsuruog /types/react-broadcast/ @kandros @@ -2918,12 +3053,13 @@ /types/react-calendar-heatmap/ @9renpoto /types/react-calendar-timeline/ @radziksh /types/react-cartographer/ @trevonmckay +/types/react-click-outside/ @screendriver /types/react-codemirror/ @velveret @rudi-c /types/react-collapse/ @Kimahriman /types/react-color/ @LKay @markspolakovs @mntdn /types/react-confirm/ @santiagodoldan /types/react-content-loader/ @alaatm -/types/react-copy-to-clipboard/ @mabels +/types/react-copy-to-clipboard/ @mabels @BernabeFelix /types/react-cropper/ @stepancar /types/react-css-modules/ @KostyaEsmukov @skirsdeda /types/react-css-transition-replace/ @LKay @@ -2933,7 +3069,7 @@ /types/react-data-grid/ @SupernaviX @KieranPeat @martinnov92 /types/react-datagrid/ @stephenjelfs /types/react-date-range/ @Junbong -/types/react-datepicker/ @radziksh @andrewBalekha @smrq @Rogach @royxue +/types/react-datepicker/ @radziksh @andrewBalekha @smrq @Rogach @royxue @KoalaHuman /types/react-daterange-picker/ @uncovertruth @MartynasZilinskas /types/react-dates/ @Artur-A /types/react-daum-postcode/ @Sa-ryong @@ -2948,13 +3084,15 @@ /types/react-dropzone/v2/ @matdube @LynxEyes @goblindegook @benbayard /types/react-dropzone/v3/ @matdube @LynxEyes @goblindegook @benbayard @LKay /types/react-dropzone/ @matdube @LynxEyes @goblindegook @benbayard @LKay @codeaid @jurosh +/types/react-dynamic-number/ @eugrdn /types/react-easy-chart/ @danzel /types/react-event-listener/ @asvetliakov /types/react-fa/ @flaub @patsissons @LKay /types/react-facebook-login/ @apare @jankarres -/types/react-faux-dom/ @alitaheri @cleverguy25 +/types/react-faux-dom/ @alitaheri @cleverguy25 @deviousm /types/react-file-input/ @dmitryrogozhny /types/react-file-reader-input/ @dmitryrogozhny @alitaheri +/types/react-flags-select/ @senukartur /types/react-flatpickr/ @begincalendar /types/react-flex/ @pushplay /types/react-flexr/ @pushplay @@ -2969,6 +3107,7 @@ /types/react-hamburger-menu/ @grzesie2k /types/react-helmet/v4/ @evanbb @isman-usoh /types/react-helmet/ @evanbb @isman-usoh @lith-light-g @sammkj @yuit +/types/react-helmet-async/ @forabi /types/react-highlight-words/ @mhegazy /types/react-highlighter/ @oizie /types/react-holder/ @isman-usoh @@ -2986,7 +3125,7 @@ /types/react-input-calendar/ @stepancar /types/react-input-mask/ @apare /types/react-intl/v1/ @bgrieder -/types/react-intl/ @bgrieder @cdroulers @gyzerok @tillwolff @LKay @bhouser @kristerkari +/types/react-intl/ @bgrieder @cdroulers @gyzerok @tillwolff @LKay @bhouser @kristerkari @formatlos /types/react-intl-redux/ @LKay /types/react-is-deprecated/ @seansfkelley /types/react-joyride/ @DanielRosenwasser @bendxn @@ -2997,7 +3136,7 @@ /types/react-lazyload/ @m0a /types/react-leaflet/ @danzel @davschne @yuit /types/react-list/ @buptyyf @tomshen -/types/react-loadable/ @Kovensky @odensc +/types/react-loadable/ @Kovensky @odensc @ianks @tlaziuk /types/react-loader/ @artfuldev /types/react-maskedinput/ @LKay @lavoaster @CarlosBonetti /types/react-mce/ @morphologue @@ -3006,7 +3145,7 @@ /types/react-mixin/ @tkqubo /types/react-modal/ @radziksh @drewnoakes @homburg @ttamminen @hallowatcher @peterblazejewicz /types/react-monaco-editor/ @jnetterf -/types/react-motion/ @stepancar @asvetliakov +/types/react-motion/ @stepancar @asvetliakov @dimitarnestorov /types/react-motion-slider/ @asvetliakov /types/react-native/ @alloy @huhuanming @iRoachie @timwangdev @kamal @nelyousfi /types/react-native-collapsible/ @iRoachie @@ -3023,19 +3162,21 @@ /types/react-native-google-signin/ @j-fro /types/react-native-keep-awake/ @huhuanming /types/react-native-linear-gradient/ @j-fro +/types/react-native-loading-spinner-overlay/ @fhelwanger /types/react-native-material-design-searchbar/ @iRoachie /types/react-native-material-kit/ @iRoachie @timwangdev /types/react-native-material-ui/ @iRoachie /types/react-native-mixpanel/ @r3nya /types/react-native-modalbox/ @iRoachie +/types/react-native-navigation/ @egorshulga /types/react-native-orientation/ @MoLow /types/react-native-popup-dialog/ @PaitoAnderson @connectdotz -/types/react-native-push-notification/ @PaitoAnderson +/types/react-native-push-notification/ @PaitoAnderson @tomSawkins /types/react-native-qrcode/ @plantain-00 /types/react-native-safari-view/ @mrand01 -/types/react-native-scrollable-tab-view/ @CaiHuan +/types/react-native-scrollable-tab-view/ @CaiHuan @egorshulga /types/react-native-sensor-manager/ @SahinVardar -/types/react-native-snap-carousel/ @jnbt +/types/react-native-snap-carousel/ @jnbt @j-fro /types/react-native-sortable-grid/ @j-fro /types/react-native-sortable-list/ @sivolobov /types/react-native-svg-uri/ @iRoachie @@ -3045,12 +3186,13 @@ /types/react-native-touch-id/ @huhuanming /types/react-native-vector-icons/ @iRoachie @timwangdev /types/react-native-video/ @huhuanming @abrahambotros -/types/react-navigation/ @huhuanming @mhcgrq @fangpenlin @abrahambotros @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko +/types/react-navigation/ @huhuanming @mhcgrq @fangpenlin @abrahambotros @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @robertohuertasm @YourGamesBeOver /types/react-notification-system/ @GiedriusGrabauskas @DeividasBakanas @LKay @sztobar /types/react-notification-system-redux/ @LKay /types/react-numeric-input/ @heatherbooker /types/react-onclickoutside/v5/ @LKay /types/react-onclickoutside/ @LKay +/types/react-onsenui/ @salim7 @jemmyw /types/react-overlays/ @aaronbeall @vitosamson /types/react-paginate/ @deevus @wouterhardeman @pegel03 @archy-bold /types/react-pointable/ @istefo @mdibyo @@ -3058,29 +3200,32 @@ /types/react-props-decorators/ @tkqubo /types/react-recaptcha/ @mhegazy @zzanol /types/react-redux/ @tkqubo @thasner @kenzierocks @clayne11 @tansongyang @nicholasboll @mdibyo @pdeva +/types/react-redux-epic/ @forabi /types/react-redux-i18n/ @clementdevos /types/react-redux-toastr/ @Smiche @artyomsv @kulmajaba -/types/react-relay/ @graphcool @voxmatt @alloy +/types/react-relay/ @graphcool @voxmatt @alloy @npirotte /types/react-resolver/ @forabi /types/react-responsive/v1/ @asvetliakov /types/react-responsive/ @asvetliakov @alechill @xaviergonz /types/react-router/v2/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov /types/react-router/v3/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov @johnnyreilly @LKay @DovydasNavickas @ssorallen -/types/react-router/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov @johnnyreilly @LKay @DovydasNavickas @tkrotoff @huy-nguyen @grmiade @DaIgeb @egorshulga +/types/react-router/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov @johnnyreilly @LKay @DovydasNavickas @tkrotoff @huy-nguyen @grmiade @DaIgeb @egorshulga @neuoy /types/react-router-bootstrap/ @vlesierse @LKay @olmobrutall /types/react-router-config/ @lith-light-g /types/react-router-dom/ @tkrotoff @huy-nguyen /types/react-router-native/ @ezintz +/types/react-router-navigation/ @kaoDev +/types/react-router-navigation-core/ @kaoDev /types/react-router-redux/v3/ @isman-usoh @noah79 @rosendi /types/react-router-redux/v4/ @isman-usoh @noah79 @rosendi @LKay @DovydasNavickas /types/react-router-redux/ @huy-nguyen @8398a7 /types/react-s-alert/ @mitsuruog /types/react-scroll/ @sudoplz @GiedriusGrabauskas /types/react-scrollbar/ @stephenjelfs -/types/react-select/ @Hesquibet @giladgray @iebaker @skirsdeda @vujevits @devrelm @MartynasZilinskas @onatm @ninjaferret @tehbi4 +/types/react-select/ @Hesquibet @giladgray @iebaker @skirsdeda @vujevits @devrelm @MartynasZilinskas @onatm @ninjaferret @tehbi4 @misantronic /types/react-side-effect/ @remojansen /types/react-sidebar/ @jeroenvervaeke -/types/react-sketchapp/ @ricokahler +/types/react-sketchapp/ @ricokahler @DomiR /types/react-slick/ @andrewBalekha @GiedriusGrabauskas @r3nya /types/react-smooth-scrollbar/ @asvetliakov /types/react-sortable-hoc/ @NoHomey @charlesrey @@ -3105,6 +3250,7 @@ /types/react-test-renderer/v15/ @arvitaly @lochbrunner @lochbrunner @johnnyreilly /types/react-test-renderer/ @arvitaly @lochbrunner @johnnyreilly @jgoz /types/react-tether/ @ryprice +/types/react-text-mask/ @guilhermehubner /types/react-textarea-autosize/ @asvetliakov @zry656565 /types/react-toastr/ @shssoichiro /types/react-toggle/v2/ @LKay @@ -3116,28 +3262,31 @@ /types/react-transition-group/ @LKay /types/react-treeview/ @janslow /types/react-truncate/ @mattvperry +/types/react-twitter-auth/ @paulfasola /types/react-user-tour/ @ccancellieri /types/react-virtual-keyboard/ @bsurai /types/react-virtualized/ @kaoDev @guntherjh @wasd171 @szabolcsx @kraenhansen /types/react-virtualized-select/ @seansfkelley /types/react-weui/ @tairan -/types/react-widgets/ @rogierschouten @sanyatuning @frodehansen2 +/types/react-widgets/ @rogierschouten @sanyatuning @frodehansen2 @r3nya /types/react-widgets-moment/ @dawnmist /types/react-youtube/ @kgtkr /types/reactable/ @spielc /types/reactcss/ @chrisgervang @LKay /types/reactstrap/v4/ @alihammad @mfal @danilobjr @fabiopaiva -/types/reactstrap/ @alihammad @mfal @danilobjr @fabiopaiva @FaithForHumans @KurtPreston +/types/reactstrap/ @alihammad @mfal @danilobjr @fabiopaiva @FaithForHumans @KurtPreston @kraenhansen @timc13 /types/read/ @timjk /types/read-chunk/ @crispybee /types/read-package-tree/ @mgroenhoff /types/read-pkg/ @jdxcode /types/read-pkg-up/ @dudeofawesome @jdxcode +/types/readdir-enhanced/ @mrmlnc /types/readdir-stream/ @Bartvds /types/readline-sync/ @jonestristand +/types/readline-transform/ @dex4er /types/reapop/ @Barrokgl /types/recase/ @18steps -/types/recharts/ @mthmulders @rapmue @royxue @ZheyangSong +/types/recharts/ @mthmulders @rapmue @royxue @ZheyangSong @richbai90 /types/recompose/ @iskandersierra @mrapogee @clayne11 /types/reconnectingwebsocket/ @nguarracino /types/recursive-readdir/v1/ @elisee @@ -3171,6 +3320,7 @@ /types/redux-immutable-state-invariant/ @remojansen @highflying /types/redux-infinite-scroll/ @silkyfray /types/redux-injectable-store/ @unindented +/types/redux-little-router/ @priecint /types/redux-localstorage/ @LKay /types/redux-localstorage-debounce/ @LKay /types/redux-localstorage-filter/ @LKay @@ -3184,6 +3334,7 @@ /types/redux-promise-middleware/ @ianks /types/redux-recycle/ @LKay /types/redux-router/ @stepancar +/types/redux-socket.io/ @snakeego /types/redux-storage/ @asvetliakov /types/redux-storage-engine-jsurl/ @screendriver /types/redux-storage-engine-localstorage/ @screendriver @@ -3196,20 +3347,23 @@ /types/relateurl/ @tkrotoff /types/relaxed-json/ @18steps /types/relay-runtime/ @voxmatt @alloy +/types/remarkable/ @makepost /types/remote-redux-devtools/ @ColinEberhardt @unindented /types/remove-markdown/ @RagibHasin /types/replace-ext/ @DeividasBakanas /types/request/ @soywiz @bonnici @Bartvds @joeskeen @ccurrens @lookfirst @mastermatt /types/request-ip/ @mrhen -/types/request-promise/ @cglantschnig @joeskeen @AyaMorisawa -/types/request-promise-native/ @gustavohenke +/types/request-promise/ @cglantschnig @joeskeen @AyaMorisawa @mastermatt +/types/request-promise-native/ @gustavohenke @mastermatt /types/requestretry/ @EricByers @trainerbill /types/require-dir/ @weekens /types/require-directory/ @Igmat /types/require-from-string/ @ikatyang +/types/require-relative/ @MattiasBuelens /types/requirejs/ @jbaldwin /types/requirejs-domready/ @lefb766 /types/resemblejs/ @pimterry +/types/reservoir/ @danvk /types/resolve/ @marionebl @ajafff /types/resolve-from/ @unional /types/resourcejs/ @shaunluttin @@ -3228,12 +3382,14 @@ /types/resumablejs/ @DanielMcAssey /types/rethinkdb/ @alexgorbatchev /types/retry/ @krenor +/types/retry-as-promised/ @Raigen /types/rev-hash/ @ikatyang /types/revalidate/ @alex3165 /types/revalidator/ @brewsoftware /types/reveal/ @robertop87 @Nava2 /types/rewire/ @borislavjivkov @CaselIT /types/rfc2047/ @mugifly +/types/rgrove__parse-xml/ @petejohanson /types/rheostat/ @SashaBayan @kourge /types/rickshaw/ @niemyjski /types/rimraf/ @soywiz @e-cloud @bash @@ -3244,16 +3400,16 @@ /types/riotjs/ @vvakame /types/rison/ @impworks /types/rivets/ @TrevorDev @matjanos -/types/rollup/ @flying-sheep @csvn +/types/roads/ @dancespiele /types/rollup-plugin-json/ @asmockler /types/ronomon__crypto-async/ @BendingBender /types/rosie/ @abner @subvertallchris -/types/roslib/ @Pro @skycoop +/types/roslib/ @Pro @skycoop @dgorobopec /types/rot-js/ @atiaxi /types/route-parser/ @ianks @bobbuehler /types/routie/ @Adilson /types/royalslider/ @csrakowski -/types/rpio/ @DominikPalo +/types/rpio/ @DominikPalo @Pencl /types/rrc/ @DeividasBakanas /types/rrule/ @waratuman /types/rsmq/ @MugeSo @@ -3280,6 +3436,7 @@ /types/rx-lite-time/ @Igorbek /types/rx-lite-virtualtime/ @Igorbek /types/rx.wamp/ @darkl +/types/s3-download-stream/ @everettcaleb /types/s3-upload-stream/ @geoffreak /types/safari-extension/ @luukd /types/safari-extension-content/ @luukd @@ -3298,6 +3455,7 @@ /types/sanitize-html/ @rogierschouten @afshin @BehindTheMath /types/sap__xsenv/ @mad-mike /types/sass-graph/ @marvinhagemeister +/types/sass-webpack-plugin/ @AepKill /types/sat/ @omni360 /types/satnav/ @DotNetNerd /types/saywhen/ @SeanSobey @@ -3310,7 +3468,7 @@ /types/scroller/ @haskellcamargo /types/scrollreveal/ @Davidblkx /types/scrolltofixed/ @bmdixon -/types/scrypt-async/ @xStrom +/types/scrypt-async/ @xStrom @stesix /types/scryptsy/ @micksatana /types/seamless/ @danmana /types/seamless-immutable/ @alex3165 @xsburg @geirsagberg @@ -3350,7 +3508,7 @@ /types/send/ @MikeJerred /types/seneca/ @psnider /types/sequelize/v3/ @samuelneff @codeanimal @drinchev @morpheusxaut @torhal -/types/sequelize/ @samuelneff @codeanimal @drinchev @babolivier @kukoo1 @oktapodia @morpheusxaut @TitaneBoy @zjy01 +/types/sequelize/ @samuelneff @codeanimal @drinchev @babolivier @kukoo1 @oktapodia @morpheusxaut @TitaneBoy @zjy01 @nidzov @Raigen @todd /types/sequelize-fixtures/ @cschwarz /types/sequencify/ @npenin /types/sequester/ @Strate @@ -3363,6 +3521,7 @@ /types/server-destroy/ @gyszalai /types/session-file-store/ @blendsdk @rokt33r /types/set-cookie-parser/ @nickp10 +/types/set-value/ @DanielRosenwasser /types/sha1/ @arcdev1 /types/shallowequal/ @seansfkelley /types/shapefile/ @DenisCarriere @@ -3379,7 +3538,8 @@ /types/shopify-buy/ @openminder /types/shortid/ @stpettersens @despairblue /types/shot/ @AJamesPhillips -/types/showdown/ @cbowdon @tan9 @arielsaldana +/types/should-sinon/ @Arylo +/types/showdown/ @cbowdon @tan9 /types/shrink-ray/ @forabi /types/siema/ @Irmiz @0x6368656174 @samnau /types/siesta/ @bquarmby @@ -3391,33 +3551,37 @@ /types/signature_pad/ @AbubakerB @jrmihalick /types/simple-assign/ @NoHomey /types/simple-cw-node/ @vvakame +/types/simple-lru/ @NN--- /types/simple-mock/ @leonyu /types/simple-oauth2/ @mad-mike /types/simple-peer/ @tlaziuk /types/simple-url-cache/ @a-lucas /types/simple-xml/ @notVitaliy /types/simplebar/v1/ @gregonnet @leonard-thieu -/types/simplebar/ @leonard-thieu +/types/simplebar/ @gregonnet @leonard-thieu /types/simplemde/ @Scalesoft /types/simplesmtp/ @rogierschouten /types/simplestorage.js/ @axelcostaspena @mxl +/types/single-line-log/ @ffflorian /types/sinon/ @mrbigdog2u @rationull @lumaxis @nicojs @43081j /types/sinon-as-promised/ @igrayson /types/sinon-chai/ @kazimanzurrashid @jedmao -/types/sinon-chrome/ @pimterry +/types/sinon-chrome/ @pimterry @crimx /types/sinon-express-mock/ @jpchip @tlaziuk /types/sinon-mongoose/ @stevehipwell -/types/sinon-stub-promise/ @vintem +/types/sinon-stub-promise/ @vintem @tstackhouse /types/sinon-test/ @mummybot /types/sip.js/ @decyrus /types/sipml/ @chookies /types/sitemap2/ @shundy /types/sizzle/ @leonard-thieu /types/sjcl/ @Evgenus +/types/skatejs/ @Hotell /types/ski/ @AyaMorisawa /types/skyway/ @nakakura /types/slack-node/ @geoffreak /types/slack-winston/ @BlueHatbRit +/types/slackdown/ @nju33 /types/slackify-html/ @hypexr /types/slate-irc/ @elisee /types/sleep/ @rajarz @@ -3439,8 +3603,9 @@ /types/socket.io/ @progre @divillysausages @florentpoujol @KentarouTakeda @gigi /types/socket.io-client/ @progre @divillysausages @florentpoujol /types/socket.io-parser/ @plantain-00 -/types/socket.io-redis/ @nupplaphil +/types/socket.io-redis/ @nupplaphil @seeLuck /types/socket.io.users/ @kataras +/types/socketio-jwt-auth/ @codeanimal /types/socketio-wildcard/ @BendingBender /types/socketty/ @Nax /types/sockjs/ @pmccloghrylaing @@ -3461,7 +3626,7 @@ /types/spdx-correct/ @jinwoo /types/spdx-satisfies/ @jinwoo /types/spdy/ @tony19 -/types/speakeasy/ @legendecas @mrOlorin +/types/speakeasy/ @legendecas @mrOlorin @xeoneux /types/speakingurl/ @Goldsmith42 /types/spectacle/ @zmaybury /types/spectrum/ @M-Zuber @@ -3469,7 +3634,7 @@ /types/split.js/ @icholy /types/split2/ @mugeso /types/spotify-api/ @skovmand -/types/spotify-web-playback-sdk/ @Festify +/types/spotify-web-playback-sdk/ @Festify @mraerino @NeoLegends /types/sprintf/ @soywiz @BendingBender /types/sprintf-js/ @jasonswearingen @BendingBender /types/sql.js/ @Hozuki @@ -3493,21 +3658,24 @@ /types/stats.js/ @gregolai @hberntsen @danvk /types/statsd-client/ @peterkooijmans @chrisleck /types/statuses/ @tkrotoff @BendingBender +/types/std-mocks/ @jdxcode /types/steam/ @kant2002 /types/steed/ @Paul-Isache /types/stemmer/ @will-ockmore /types/sticky-cluster/ @paustint -/types/stompjs/ @jimic +/types/stompjs/ @jimic @Dr4k4n /types/stoppable/ @EricByers /types/storejs/ @vbortone @harry0000 +/types/storybook__addon-a11y/ @hyunseob /types/storybook__addon-actions/ @joscha /types/storybook__addon-backgrounds/ @hyunseob /types/storybook__addon-info/ @mkornblum @fyrkant /types/storybook__addon-knobs/ @joscha @martynaskadisa -/types/storybook__addon-links/ @joscha +/types/storybook__addon-links/ @joscha @jessepinho /types/storybook__addon-notes/ @joscha /types/storybook__addon-options/ @joscha /types/storybook__react/ @joscha @wapgear +/types/storybook__vue/ @pntgupta /types/stream-buffers/ @Jason3S /types/stream-meter/ @mugeso /types/stream-series/ @k-kagurazaka @@ -3530,7 +3698,9 @@ /types/stripe-v2/ @ejsmith @amritk @adamcmiel @jleider @galuszkak /types/stripe-v3/ @ejsmith @amritk @adamcmiel @jleider @galuszkak /types/strong-cluster-control/ @shuntksh +/types/strong-log-transformer/ @azasypkin /types/strophe/ @DavidKDeutsch +/types/structured-source/ @azu /types/styled-jsx/ @R1ZZU /types/stylelint/ @alan-agius4 /types/stylelint-webpack-plugin/ @bahlo @@ -3541,7 +3711,7 @@ /types/suitescript/ @darrenhillconsulting /types/sumo-logger/ @forabi /types/superagent/v2/ @varju @NicoZelaya @mxl -/types/superagent/ @NicoZelaya @mxl @paplorinc +/types/superagent/ @NicoZelaya @mxl @paplorinc @shreyjain1994 /types/superagent-no-cache/ @mxl /types/superagent-prefix/ @mxl /types/supercluster/ @DenisCarriere @@ -3555,7 +3725,7 @@ /types/svg4everybody/ @BendingBender /types/svgjs.draggable/ @LiFeleSs /types/svgjs.resize/ @jkevingutierrez -/types/svgo/ @bradleyayers +/types/svgo/ @bradleyayers @giladgray /types/swag/ @shiwano /types/swagger-express-middleware/ @alexandreroba /types/swagger-express-mw/ @micmro @@ -3588,6 +3758,7 @@ /types/tapable/ @e-cloud /types/tape/ @Bartvds @sodatea @DennisSchwartz @mikehenrty /types/tar/ @SomaticIT @connor4312 +/types/tar-fs/ @Umoxfo /types/tcp-ping/ @stegano /types/tedious/ @rogierschouten @cjthompson /types/tedious-connection-pool/ @sandorfr @@ -3604,7 +3775,7 @@ /types/text-buffer/ @GlenCFL /types/text-encoding/ @pine613 /types/text-encoding-utf-8/ @trxcllnt -/types/three/ @gyohk @florentpoujol @SereznoKot @omni360 @ivoisbelongtous @piranha771 @qszhusightp @nakakura @s093294 @Pro @efokschaner @PsychoSTS @dhritzkiv +/types/three/ @gyohk @florentpoujol @SereznoKot @omni360 @ivoisbelongtous @piranha771 @qszhusightp @nakakura @s093294 @Pro @efokschaner @PsychoSTS @dhritzkiv @apurvaojas /types/thrift/ @kamek-pf @kevin-greene-ck @jessezhang91 /types/throng/ @cyrilschumacher @tatethurston /types/throttle/ @BendingBender @@ -3623,7 +3794,7 @@ /types/tinder/ @pingec /types/tinycolor2/ @M-Zuber @geertjansen @nvh /types/tinycopy/ @vvatanabe -/types/tinymce/ @martinduparc @ipoul +/types/tinymce/ @martinduparc @ipoul @nicohartto /types/titanium/ @cyounkins /types/title/ @fa7ad /types/tldjs/ @geoffreak @@ -3660,17 +3831,19 @@ /types/tweezer.js/ @praxxis /types/twig/ @soywiz @enko /types/twilio/ @nickiannone @ashleybrener -/types/twit/ @Volox @lostfictions +/types/twit/ @Volox @lostfictions @sapphiredev /types/twitter/ @chitoku-k /types/twitter-stream-channels/ @adrianbardan /types/twitter-text/ @rhysd /types/twix/ @j3ko /types/type-check/ @hansrwindhoff +/types/type-detect/v0/ @Bartvds /types/type-detect/ @Bartvds /types/type-is/ @BendingBender /types/type-name/ @armorik83 /types/typeahead/ @igochkov @gjunge /types/typedarray-pool/ @pawsong +/types/typeof/ @OpenByteDev /types/typescript-deferred/ @DirtyHairy /types/tz-format/ @samverschueren /types/ua-parser-js/ @superduper @legendecas @MeLlamoPablo @@ -3703,26 +3876,31 @@ /types/untildify/ @BendingBender /types/unused-filename/ @BendingBender /types/unzip/ @coding2012 +/types/unzipper/ @s73obrien +/types/update-notifier/v1/ @vvakame @nchen63 /types/update-notifier/ @vvakame @nchen63 +/types/upng-js/ @plantain-00 /types/uppercamelcase/ @plantain-00 /types/urbanairship-cordova/ @Justin-Credible /types/uri-templates/ @Bartvds -/types/urijs/ @RodneyJT @xt0rted +/types/urijs/ @RodneyJT @xt0rted @petejohanson /types/uritemplate/ @teyc @rubensworks /types/url-assembler/ @wolfgang42 /types/url-join/ @rogierschouten @devrelm /types/url-metadata/ @mrkmg /types/url-parse/ @ChernenkoPaul /types/url-regex/ @unindented -/types/url-search-params/ @nick121212 +/types/url-search-params/ @nick121212 @nrathi /types/url-template/ @marcinporebski +/types/urllib/ @sorayama +/types/urlparser/ @OpenByteDev /types/urlrouter/ @soywiz /types/urlsafe-base64/ @tkrotoff /types/usage/ @pvomhoff -/types/usb/ @underscorebrody +/types/usb/ @underscorebrody @thegecko /types/user-home/ @mhegazy /types/useragent/ @geoffreak -/types/username/ @kayahr +/types/username/ @kayahr @krivachy /types/utf8/ @zelein /types/util-deprecate/ @BendingBender /types/util.promisify/ @adamvoss @@ -3752,13 +3930,14 @@ /types/vex-js/ @gdcohan /types/vexflow/ @rquiring @sebastianhaas @bohoffi /types/vfile/ @bizen241 @rokt33r +/types/vfile-location/ @ikatyang /types/victory/ @asvetliakov @snerks @Havret /types/video.js/ @vbortone @scleriot @SWBennett06 @IgelCampus /types/viewability-helper/ @lironzluf /types/viewerjs/ @lrh3321 /types/viewporter/ @borisyankov /types/vimeo/ @DazWilkin -/types/vimeo__player/ @denisyilmaz +/types/vimeo__player/ @denisyilmaz @timc13 /types/vinyl/v0/ @jedmao /types/vinyl/ @vvakame @jedmao @thorn0 /types/vinyl-buffer/ @tkQubo @@ -3767,11 +3946,14 @@ /types/virtual-dom/ @chbrown /types/virtual-keyboard/ @bsurai /types/vis/ @MichaelBitard @macleodbroad-wf @adripanico @seveves @kaktus40 @mmaitre314 @supercargo @takato1314 -/types/vision/ @jasonswearingen @AJamesPhillips +/types/vision/v4/ @jasonswearingen @AJamesPhillips +/types/vision/ @jasonswearingen @AJamesPhillips @lenovouser /types/vitalsigns/ @cyrilschumacher /types/vivus/ @DanielRosenwasser @lekhmanrus /types/vkbeautify/ @sch3lp +/types/vnu-jar/ @Umoxfo /types/voca/ @pine +/types/void-elements/ @ajafff /types/voronoi-diagram/ @michaelneu /types/vortex-web-client/ @Pro /types/voximplant-websdk/ @aylarov @@ -3794,7 +3976,7 @@ /types/watchpack/ @e-cloud /types/waterline/ @arvitaly /types/watson-developer-cloud/ @waldo000000 @Naktibalda -/types/waypoints/ @dominikbulaj @Koloto +/types/waypoints/ @dominikbulaj @Koloto @evil-shrike /types/wcwidth/ @rokt33r /types/weak/ @int0h /types/weapp-api/ @vargeek @@ -3809,9 +3991,8 @@ /types/webfontloader/ @doskallemaskin /types/webgl-ext/ @zenmumbler /types/webgl2/ @nkemnitz -/types/webix/ @mkozhukh /types/webmidi/ @lostfictions -/types/webpack/ @tkqubo @bumbleblym @bcherny @tommytroylin @mohsen1 @jcreamer898 @ahmed-taj @alan-agius4 +/types/webpack/ @tkqubo @bumbleblym @bcherny @tommytroylin @mohsen1 @jcreamer898 @ahmed-taj @alan-agius4 @elliottsj @jason0x43 /types/webpack-bundle-analyzer/ @kryops /types/webpack-chain/ @eirikurn @psachs21 /types/webpack-chunk-hash/ @mtraynham @@ -3832,7 +4013,7 @@ /types/webpack-stream/ @iclanton @bumbleblym /types/webpack-validator/ @deevus /types/webrtc/ @nakakura -/types/websocket/ @loyd @flynetworks @zhaoleimxd +/types/websocket/ @loyd @flynetworks @zhaoleimxd @jdneo /types/webspeechapi/ @saschanaz /types/websql/ @TeamworkGuy2 /types/webtorrent/ @niieani @tlaziuk @@ -3869,7 +4050,8 @@ /types/wrench/ @soywiz /types/write-file-atomic/ @BendingBender /types/write-json-file/ @DenisCarriere -/types/ws/ @loyd @elithrar @mlamp +/types/write-pkg/ @azasypkin +/types/ws/ @loyd @elithrar @mlamp @TitaneBoy /types/wtfnode/ @dex4er /types/wu/ @phiresky /types/wx-js-sdk-dt/ @agasbzj @@ -3878,13 +4060,12 @@ /types/x-ray-crawler/ @mtraynham /types/xdate/ @yamada28go /types/xdg-basedir/ @tlaziuk -/types/xhr-mock/ @joscha /types/xml/ @YuJianrong /types/xml-parser/ @mhfrantz /types/xml2js/ @michelsalib @jasonrm @ccurrens @edwardhinkle @BehindTheMath /types/xml2json/ @dolanmiu /types/xmlbuilder/ @wallymathieu -/types/xmldoc/ @Xstoudi @ajsheehan +/types/xmldoc/ @Xstoudi @ajsheehan @notlaforge /types/xmldom/ @tkqubo /types/xmlpoke/ @garthk /types/xmltojson/ @traviscrowe @@ -3895,18 +4076,19 @@ /types/xrm/ @6ix4our @mattngan @markusmauch @daryllabar @clownwilleatme @scottdurow /types/xsd-schema-validator/ @Goldsmith42 /types/xsockets/ @pushplay -/types/xterm/ @blink1073 @LucianBuzzo /types/xxhashjs/ @mDibyo /types/yallist/ @BendingBender /types/yandex-maps/ @Delagen /types/yandex-money-sdk/ @chrootsu +/types/yar/ @SimonSchick /types/yargs/v8/ @poelstra @mizunashi-mana @pushplay @jeffkenney +/types/yargs/v10/ @poelstra @mizunashi-mana @pushplay @jeffkenney @JimiC /types/yargs/ @poelstra @mizunashi-mana @pushplay @jeffkenney @JimiC +/types/yauzl/ @ffflorian /types/yayson/ @Codesleuth /types/ydn-db/ @yathit @gabrielmaldi /types/yeoman-generator/ @armorik83 @janslow @ikatyang /types/yeoman-test/ @ikatyang -/types/yfiles/ @yGuy /types/yog-bigpipe/ @ssddi456 /types/yog-log/ @ssddi456 /types/yog2-kernel/ @ssddi456 @@ -3914,7 +4096,7 @@ /types/youtube/ @DazWilkin @JoshuaKGoldberg @eliotfallon213 /types/youtube-dl/ @bsurai /types/yui/ @giabao -/types/yup/ @dhardtke @vtserman +/types/yup/ @dhardtke @vtserman @MoretonBayRC /types/z-schema/ @pgonzal /types/zapier-platform-core/ @bradleyayers /types/zen-observable/ @aicest @@ -3923,9 +4105,13 @@ /types/zepto/ @jbaldwin /types/zeroclipboard/v1/ @ejsmith @niemyjski @balassy @leonyu /types/zeroclipboard/ @ejsmith @niemyjski @balassy @leonyu -/types/zeromq/ @davemckeown @erikma +/types/zeromq/ @davemckeown @erikma @TitaneBoy /types/zip.js/ @lgrignon /types/zipcodes/ @headdetect +/types/zipkin-context-cls/ @plantain-00 +/types/zipkin-instrumentation-express/ @plantain-00 +/types/zipkin-instrumentation-fetch/ @plantain-00 +/types/zipkin-transport-http/ @plantain-00 /types/zmq/ @davemckeown /types/zookeeper/ @xialeistudio /types/zui/ @yuanxu diff --git a/types/activex-wia/activex-wia-tests.ts b/types/activex-wia/activex-wia-tests.ts index d8046ef319..c33385af14 100644 --- a/types/activex-wia/activex-wia-tests.ts +++ b/types/activex-wia/activex-wia-tests.ts @@ -1,79 +1,505 @@ +// Note -- running these tests under cscript requires some ES5 polyfills + +const collectionToArray = (col: { Item(key: any): T }): T[] => { + const results: T[] = []; + const enumerator = new Enumerator(col); + enumerator.moveFirst(); + while (!enumerator.atEnd()) { + results.push(enumerator.item()); + enumerator.moveNext(); + } + return results; +}; + // source -- https://msdn.microsoft.com/en-us/library/windows/desktop/ms630826(v=vs.85).aspx +{ + const cd = new ActiveXObject('WIA.CommonDialog'); + const dm = new ActiveXObject('WIA.DeviceManager'); -// Convert a file -let commonDialog = new ActiveXObject('WIA.CommonDialog'); -let img = commonDialog.ShowAcquireImage(); + // Download new items as they are created + { + dm.RegisterEvent(WIA.EventID.wiaEventItemCreated, WIA.Miscellaneous.wiaAnyDeviceID); + ActiveXObject.on(dm, 'OnEvent', ['EventID', 'DeviceID', 'ItemID'], x => { + const dev = dm.DeviceInfos(x.DeviceID).Connect(); + const itm = dev.GetItem(x.ItemID); + const img = cd.ShowTransfer(itm); + const v = img.FileData; + // Picture type not available in Javascript + }); + } -// when DefinitelyTyped supports Typescript 2.4 -- end of July 2017, replace these: -let jpegFormatID = '{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}'; -if (img.FormatID !== jpegFormatID) { - const ip = new ActiveXObject('WIA.ImageProcess'); - ip.Filters.Add(ip.FilterInfos.Item('Convert').FilterID); - ip.Filters.Item(1).Properties.Item('FormatID').Value = jpegFormatID; - img = ip.Apply(img); -} -// with this: -/*if (img.FormatID !== WIA.FormatID.wiaFormatJPEG) { - let ip = new ActiveXObject('WIA.ImageProcess'); - ip.Filters.Add(ip.FilterInfos.Item('Convert').FilterID); - ip.Filters.Item(1).Properties.Item('FormatID').Value = WIA.FormatID.wiaFormatJPEG; - img = ip.Apply(img); -}*/ - -// Take a picture -let dev = commonDialog.ShowSelectDevice(); -if (dev.Type === WIA.WiaDeviceType.CameraDeviceType) { - // when DefinitelyTyped supports Typescript 2.4 -- end of July 2017, replace these: - const commandID = '{AF933CAC-ACAD-11D2-A093-00C04F72DC3C}'; - const itm = dev.ExecuteCommand(commandID); - - // with this: - // let itm = dev.ExecuteCommand(WIA.CommandID.wiaCommandTakePicture); -} - -// Display detailed property information -dev = commonDialog.ShowSelectDevice(); -let e = new Enumerator(dev.Properties); // no foreach over ActiveX collections -e.moveFirst(); -while (!e.atEnd()) { - const p = e.item(); - let s = `${p.Name} (${p.PropertyID}) = `; - if (p.IsVector) { - s += '[vector of data]'; - } else { - s += p.Value; - if (p.SubType !== WIA.WiaSubType.UnspecifiedSubType) { - if (p.Value !== p.SubTypeDefault) { - s += ` (Default = ${p.SubTypeDefault})`; - } + // Convert a file + { + let img = cd.ShowAcquireImage(); + if (img && img.FormatID !== WIA.FormatID.wiaFormatJPEG) { + const ip = new ActiveXObject('WIA.ImageProcess'); + ip.Filters.Add(ip.FilterInfos('Convert').FilterID); + ip.Filters(1).Properties('FormatID').Value = WIA.FormatID.wiaFormatJPEG; + img = ip.Apply(img); } } - if (p.IsReadOnly) { - s += ' [READ ONLY]'; - } else { - switch (p.SubType) { - case WIA.WiaSubType.FlagSubType: - case WIA.WiaSubType.ListSubType: - if (p.SubType === WIA.WiaSubType.FlagSubType) { - s += ' [valid flags include: '; + // Take a picture + { + const dev = cd.ShowSelectDevice(); + if (dev && dev.Type === WIA.WiaDeviceType.CameraDeviceType) { + const item = dev.ExecuteCommand(WIA.CommandID.wiaCommandTakePicture); + } + } + + // Display detailed property information + { + const dev = cd.ShowSelectDevice(); + if (dev) { + collectionToArray(dev.Properties).forEach(p => { + let s = `${p.Name} (${p.PropertyID}) = `; + if (p.IsVector) { + s += '[vector of data]'; } else { - s += ' [valid values include: '; - } - const count = p.SubTypeValues.Count; - for (let i = 1; i <= count; i++) { - s += p.SubTypeValues.Item(i); - if (i < count) { - s += ', '; + s += p.Value; + if (p.SubType !== WIA.WiaSubType.UnspecifiedSubType + && p.Value !== p.SubTypeDefault) { + s += ` (Default = ${p.SubTypeDefault})`; } } - s += ']'; - break; - case WIA.WiaSubType.RangeSubType: - s += ` [valid values in the range from ${p.SubTypeMin} to ${p.SubTypeMax} in increments of ${p.SubTypeStep}]`; - break; + + if (p.IsReadOnly) { + s += ' [READ ONLY]'; + } else { + switch (p.SubType) { + case WIA.WiaSubType.FlagSubType: + case WIA.WiaSubType.ListSubType: + const count = p.SubTypeValues.Count; + const items: string[] = []; + for (let i = 1; i <= count; i++) { + items.push(p.SubTypeValues(i)); + } + const descr = p.SubType === WIA.WiaSubType.FlagSubType ? 'flags' : 'values'; + s += ` [valid ${descr} include: ${items.join(',')}]`; + break; + case WIA.WiaSubType.RangeSubType: + s += ` [valid values in the range from ${p.SubTypeMin} to ${p.SubTypeMax} in increments of ${p.SubTypeStep}]`; + break; + } + } + + WScript.Echo(s); + }); } } - WScript.Echo(s); + // Determine whether the selected device is a camera + { + const dev = cd.ShowSelectDevice(); + if (dev && dev.Type === WIA.WiaDeviceType.CameraDeviceType) { + WScript.Echo('Selectd device is a camera'); + } + } + + // Count root - level images for transfer + { + const dev = cd.ShowSelectDevice(); + if (dev) { + const count = collectionToArray(dev.Items).filter(f => { + const imageFlag = WIA.WiaItemFlag.ImageItemFlag; + return (f.Properties('Item Flags').Value & imageFlag) === imageFlag; + }).length; + WScript.Echo(`Selected device has ${count} top-level images`); + } + } + + // Display all imagefile properties + { + const img = cd.ShowAcquireImage(); + if (img) { + collectionToArray(img.Properties).forEach(p => { + let contents = ''; + if (p.IsVector) { + contents = '[vector data not emitted]'; + } else if (p.Type === WIA.WiaImagePropertyType.RationalImagePropertyType) { + contents = `${p.Value.Nunerator}/${p.Value.Denominator}`; + } else if (p.Type === WIA.WiaImagePropertyType.StringImagePropertyType) { + contents = `"${p.Value}"`; + } else { + contents = p.Value; + } + WScript.Echo(`${p.Name} (${p.PropertyID}) = ${contents}`); + }); + } + } + + // Determine the event type + { + const dev = cd.ShowSelectDevice(); + if (dev) { + const actionEvent = WIA.WiaEventFlag.ActionEvent; + collectionToArray(dev.Events).forEach(e => { + const msg = (e.Type & actionEvent) === actionEvent ? + `${e.Name} is an Action event` : + `${e.Name} is not an Action event`; + WScript.Echo(msg); + }); + } + } + + // Set rational numerator and denominator + { + const r = new ActiveXObject('WIA.Rational'); + r.Numerator = 1; + r.Denominator = 3; + WScript.Echo(`1/3 = ${r.Value}`); + r.Numerator = 2; + r.Denominator = 6; + WScript.Echo(`2/6 = ${r.Value}`); + } + + // Create and initialize a vector object + { + const v: WIA.Vector = new ActiveXObject('WIA.Vector'); + v.SetFromString('This is a test', true, false); + + // when iterated using Enumerator / collectionToArray, each item comes back as an Automation Byte + // https://stackoverflow.com/questions/48757982/wia-vector-returns-something-which-is-not-a-number + // so the following falls, because fromCharCode is expecting a number + // collectionToArray(v).forEach(item => WScript.Echo(String.fromCharCode(item))); + + // Instead, use the Vector's Item method, or the Vector's default property: + for (let i = 1; i <= v.Count; i++) { + WScript.Echo(String.fromCharCode(v(i))); + } + } + + // Display detailed image information + { + const img = new ActiveXObject('WIA.ImageFile'); + img.LoadFile('c:\\windows\\web\\Screen\\img102.jpg'); + + let s = ` +Width = ${img.Width} +Height = ${img.Height} +Depth = ${img.PixelDepth} +Horizontal resolution = ${img.HorizontalResolution} +Vertical resolution = ${img.VerticalResolution} +Frame count = ${img.FrameCount}} + `.trim(); + + let arr: string[] = []; + + if (img.IsIndexedPixelFormat) { arr.push('Pixel data contains palette indexes'); } + if (img.IsAlphaPixelFormat) { arr.push('Pixel data has alpha information'); } + if (img.IsExtendedPixelFormat) { arr.push('Pixel data has extended color information (16 bit/channel)'); } + if (img.IsAnimated) { arr.push('Image is animated'); } + + const propertyTests = [40091, 40092, 40093, 40094, 40095] + .filter(n => img.Properties.Exists(n)) + .map(n => { + const prp = img.Properties(n); + return `${prp.Name} = ${prp.Value.String}`; + }); + arr = arr.concat(propertyTests); + + if (arr.length) { + s += '\n' + arr.join('\n'); + } + + WScript.Echo(s); + } + + // Create an imageprocess object and enumerate filters + { + const ip = new ActiveXObject('WIA.ImageProcess'); + collectionToArray(ip.FilterInfos).forEach(fi => { + const s = [ + fi.Name, + new Array(51).join('='), + fi.Description + ].join('\n'); + WScript.Echo(s); + }); + } + + // Create an imageprocess object and create one of each available filter + { + const ip = new ActiveXObject('WIA.ImageProcess'); + + const stringValue = (v: any) => { + if (typeof v === 'string') { return `"${v}"`; } + return v; + }; + + const listValues = (v: any) => collectionToArray(v).join(', '); + + const listProperties = (filter: WIA.Filter) => { + let s = [ + `${filter.Name} (${filter.FilterID})`, + new Array(51).join('='), + filter.Description, + new Array(51).join('=') + ].map(line => line + '\n').join(''); + + s += collectionToArray(filter.Properties).map(p => { + let contents: string; + + switch (typeof p.Value) { + // these case clauses replace the IsObject function in VB6/VBScript + case 'boolean': + case 'string': + case 'number': + contents = stringValue(p.Value); + default: + switch (p.SubType) { + case WIA.WiaSubType.FlagSubType: + contents = ` // [valid values formed by using the OR operator with the following bit flags: ${listValues(p.SubTypeValues)}]`; + break; + case WIA.WiaSubType.ListSubType: + contents = ` // [valid values from the following list: ${listValues(p.SubTypeValues)}]`; + break; + case WIA.WiaSubType.RangeSubType: + contents = ` // [valid values between ${p.SubTypeMin} and ${p.SubTypeMax}, with a step of ${p.SubTypeStep}]`; + break; + default: + contents = ''; + break; + } + } + + return `ip.Filters(1).Properties("${p.Name}") = ${contents}`; + }).join('\n'); + + WScript.Echo(s); + }; + + collectionToArray(ip.FilterInfos).forEach(fi => { + ip.Filters.Add(fi.FilterID); + listProperties(ip.Filters(1)); + ip.Filters.Remove(1); + }); + } + + // List the supported transfer formats + { + const stringFormat = (fld: string) => { + switch (fld) { + case WIA.FormatID.wiaFormatBMP: return 'BMP'; + case WIA.FormatID.wiaFormatPNG: return 'PNG'; + case WIA.FormatID.wiaFormatGIF: return 'GIF'; + case WIA.FormatID.wiaFormatJPEG: return 'JPEG'; + case WIA.FormatID.wiaFormatTIFF: return 'TIFF'; + default: return 'Unknown'; + } + }; + + const dev = cd.ShowSelectDevice(); + const items = dev && cd.ShowSelectItems(dev, WIA.WiaImageIntent.UnspecifiedIntent, WIA.WiaImageBias.MaximizeQuality, true); + if (items) { + WScript.Echo(collectionToArray(items(1).Formats).map(stringFormat).join(', ')); + } + } + + // Enumerate supported commands in commands collection + { + const dev = cd.ShowSelectDevice(); + if (dev && collectionToArray(dev.Commands).some(dc => dc.CommandID === WIA.CommandID.wiaCommandTakePicture)) { + WScript.Echo('Selected device supports the TakePicture command'); + } + } + + // Enumerate root - level items and display their names + { + const dev = cd.ShowSelectDevice(); + if (dev) { + collectionToArray(dev.Items).forEach(item => { + let s: string = item.Properties("Item Name").Value; + if (item.Properties.Exists("Item Time Stamp")) { + const v: WIA.Vector = item.Properties("Item Time Stamp").Value; + if (v.Count === 8) { s += ` (${v.Date})`; } + } + WScript.Echo(s); + }); + } + } + + // Determine the number of items returned by ShowSelectItems + { + const dev = cd.ShowSelectDevice(); + const items = dev && cd.ShowSelectItems(dev, WIA.WiaImageIntent.UnspecifiedIntent, WIA.WiaImageBias.MaximizeQuality, true); + if (items) { + WScript.Echo(`You selected ${items.Count} items`); + } + } + + // Enumerate all the supported events for the selected device + { + const dev = cd.ShowSelectDevice(); + if (dev) { + const msg = collectionToArray(dev.Events) + .map(e => `\n${e.Name} (${e.EventID}): ${e.Description}`) + .join(''); + WScript.Echo('The selected device supports the following events: ' + msg); + } + } + + // List all available devices by name and deviceid + collectionToArray(dm.DeviceInfos).forEach(di => { + const name: string = di.Properties("Name").Value; + WScript.Echo(`${name} (${di.DeviceID})`); + }); + + // Display all the properties for the selected device + { + const dev = cd.ShowSelectDevice(); + if (dev) { + collectionToArray(dev.Properties).forEach(p => { + const name = `${p.Name} (${p.PropertyID})`; + let contents: string; + if (p.IsVector) { + contents = '[vector of data]'; + } else if (p.Type === WIA.WiaPropertyType.StringPropertyType) { + contents = `"${p.Value}"`; + } else { + contents = p.Value; + } + WScript.Echo(`${name} = ${contents}`); + }); + } + } + + // Enumerate the supported commands + { + const dev = cd.ShowSelectDevice(); + const items = dev && cd.ShowSelectItems(dev, WIA.WiaImageIntent.UnspecifiedIntent, WIA.WiaImageBias.MaximizeQuality, true); + if (items) { + const msg = collectionToArray(items(1).Commands) + .map(c => `${c.Name}: ${c.Description}\n`) + .join(''); + WScript.Echo(`The selected item supports the following commands:\n${msg}`); + } + } + + // Create an imagefile object that contains a blank page + { + // This fails with the error: `The Vector's Type is not compatible with this operation` + /*const c = 0xFF0000FF; + const v: WIA.Vector = new ActiveXObject('WIA.Vector'); + for (let i = 0; i < 4; i++) { + v.Add(c); + } + const img = v.ImageFile(2, 2); + img.SaveFile('C:\\test.' + img.FileExtension);*/ + } + + interface WshArgumentsBase { + Item(index: TKey): string; + (index: TKey): string; + length: number; + Count(): number; + } + + interface WshArguments extends WshArgumentsBase { // not sure if WshArguments takes a string as well, or only a number + Named: WshArgumentsBase; + Unnamed: WshArgumentsBase; + ShowUsage(): void; + } + + // Implement a windows script host script that runs automatically + { + const args = collectionToArray(WScript.Arguments as WshArguments) + .map(arg => arg.toLowerCase()); + + switch (args.length) { + case 1: + case 2: + const command = `${WScript.FullName} "${WScript.ScriptFullName}" connect`; + const name = 'QuickTransfer'; + const title = 'Quick Scripting Transfer'; + const icon = `${WScript.FullName}, 0`; + const eventID = WIA.EventID.wiaEventDeviceConnected; + const deviceID = args.length === 2 ? args[1] : WIA.Miscellaneous.wiaAnyDeviceID; + + if (args[0] === 'register') { + WScript.Echo('Registering event handler'); + dm.RegisterPersistentEvent(command, name, title, icon, eventID, deviceID); + WScript.Quit(); + } else if (args[0] === 'unregister') { + WScript.Echo('Unregistering event handler'); + dm.UnregisterPersistentEvent(command, name, title, icon, eventID, deviceID); + WScript.Quit(); + } + break; + case 3: + if (args[0] === 'connect') { + const deviceID = args[1].substr(12); + const device = dm.DeviceInfos(deviceID).Connect(); + collectionToArray(device.Items).forEach(item => { + const img = item.Transfer(); + img.SaveFile(`C:\\${item.Properties('Item Name').Value}.${img.FileExtension}`); + + // Uncomment the following lines to remove the picture from the camera after transfer + for (let i = 1; i < device.Items.Count; i++) { + const item2 = device.Items(i); + if (item2.ItemID !== item.ItemID) { continue; } + try { + // some cameras don't support deleting a picture + device.Items.Remove(i); + } catch (error) { + WScript.Echo(error); + } + } + }); + WScript.Quit(); + } + break; + } + + const usage = ` +Usage: + +To register, type: + + ${WScript.ScriptName} register [] + +To unregister, type: + + ${WScript.ScriptName} unregister [] + +Available device ids: +${collectionToArray(dm.DeviceInfos) + .map(device => `${device.DeviceID} '${device.Properties("Name").Value}'`) + .join('\n')} + `.trim(); + + WScript.Echo(usage); + } + + // Count the number of child items available for transfer + { + const device = cd.ShowSelectDevice(); + const items = device && cd.ShowSelectItems(device, WIA.WiaImageIntent.UnspecifiedIntent, WIA.WiaImageBias.MaximizeQuality, true); + const item = items && items(1); + if (item) { + const count = collectionToArray(item.Items).filter(childItem => { + const flags = childItem.Properties('Item Flags').Value as number; + return (flags & WIA.WiaItemFlag.TransferItemFlag) === WIA.WiaItemFlag.TransferItemFlag; + }).length; + WScript.Echo(`Selected device has ${count} child items that can be transferred.`); + } + } + + // Use a vector object + { + const v: WIA.Vector = new ActiveXObject('WIA.Vector'); + v.Add(1); + v.Add(42); + v.Add(3); + v.Remove(1); + v.Remove(2); + WScript.Echo(`v(1) = ${v(1)}`); + v.Clear(); + v.Add('This'); + v.Add('is'); + v.Add('Cool'); + v.Remove(1); + v.Remove(2); + WScript.Echo(`v(1) = ${v(1)}`); + } } diff --git a/types/activex-wia/index.d.ts b/types/activex-wia/index.d.ts index 7d7cbae727..18e474e09c 100644 --- a/types/activex-wia/index.d.ts +++ b/types/activex-wia/index.d.ts @@ -2,22 +2,20 @@ // Project: https://msdn.microsoft.com/en-us/library/windows/desktop/ms630368(v=vs.85).aspx // Definitions by: Zev Spitz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Typescript Version: 2.4 +// TypeScript Version: 2.6 declare namespace WIA { /** String versions of globally unique identifiers (GUIDs) that identify common Device and Item commands. */ - // uncomment when DefinitelyTyped supports Typescript 2.4 (end of July 2017) - /*const enum CommandID { + const enum CommandID { wiaCommandChangeDocument = '{04E725B0-ACAE-11D2-A093-00C04F72DC3C}', wiaCommandDeleteAllItems = '{E208C170-ACAD-11D2-A093-00C04F72DC3C}', wiaCommandSynchronize = '{9B26B7B2-ACAD-11D2-A093-00C04F72DC3C}', wiaCommandTakePicture = '{AF933CAC-ACAD-11D2-A093-00C04F72DC3C}', - wiaCommandUnloadDocument = '{1F3B3D8E-ACAE-11D2-A093-00C04F72DC3C}' - }*/ + wiaCommandUnloadDocument = '{1F3B3D8E-ACAE-11D2-A093-00C04F72DC3C}', + } /** String versions of globally unique identifiers (GUIDs) that identify DeviceManager events. */ - // uncomment when DefinitelyTyped supports Typescript 2.4 (end of July 2017) - /*const enum EventID { + const enum EventID { wiaEventDeviceConnected = '{A28BBADE-64B6-11D2-A231-00C04FA31809}', wiaEventDeviceDisconnected = '{143E4E83-6497-11D2-A231-00C04FA31809}', wiaEventItemCreated = '{4C8F4EF5-E14F-11D2-B326-00C04F68CE61}', @@ -30,50 +28,48 @@ declare namespace WIA { wiaEventScanImage3 = '{154E27BE-B617-4653-ACC5-0FD7BD4C65CE}', wiaEventScanImage4 = '{A65B704A-7F3C-4447-A75D-8A26DFCA1FDF}', wiaEventScanOCRImage = '{9D095B89-37D6-4877-AFED-62A297DC6DBE}', - wiaEventScanPrintImage = '{B441F425-8C6E-11D2-977A-0000F87A926F}' - }*/ + wiaEventScanPrintImage = '{B441F425-8C6E-11D2-977A-0000F87A926F}', + } /** String versions of globally unique identifiers (GUIDs) that indicate the file format of an image. */ - // uncomment when DefinitelyTyped supports Typescript 2.4 (end of July 2017) - /*const enum FormatID { + const enum FormatID { wiaFormatBMP = '{B96B3CAB-0728-11D3-9D7B-0000F81EF32E}', wiaFormatGIF = '{B96B3CB0-0728-11D3-9D7B-0000F81EF32E}', wiaFormatJPEG = '{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}', wiaFormatPNG = '{B96B3CAF-0728-11D3-9D7B-0000F81EF32E}', - wiaFormatTIFF = '{B96B3CB1-0728-11D3-9D7B-0000F81EF32E}' - }*/ + wiaFormatTIFF = '{B96B3CB1-0728-11D3-9D7B-0000F81EF32E}', + } /** Miscellaneous string constants */ - // uncomment when DefinitelyTyped supports Typescript 2.4 (end of July 2017) - /*const enum Miscellaneous { + const enum Miscellaneous { wiaAnyDeviceID = '*', - wiaIDUnknown = '{00000000-0000-0000-0000-000000000000}' - }*/ + wiaIDUnknown = '{00000000-0000-0000-0000-000000000000}', + } /** * The WiaDeviceType enumeration specifies the type of device attached to a user's computer. Use the Type property on the DeviceInfo object or the Device - * object to obtain these values from the device. + * object to obtain these values from the device. */ const enum WiaDeviceType { CameraDeviceType = 2, ScannerDeviceType = 1, UnspecifiedDeviceType = 0, - VideoDeviceType = 3 + VideoDeviceType = 3, } /** - * A DeviceEvent's type is composed of bits from the WiaEventFlags enumeration. You can test a DeviceEvent's type by using the AND operation with DeviceEv - * ent.Type and a member from the WiaEventFlags enumeration. + * A DeviceEvent's type is composed of bits from the WiaEventFlags enumeration. You can test a DeviceEvent's type by using the AND operation with + * DeviceEvent.Type and a member from the WiaEventFlags enumeration. */ const enum WiaEventFlag { ActionEvent = 2, - NotificationEvent = 1 + NotificationEvent = 1, } /** The WiaImageBias enumeration helps specify what type of data the image is intended to represent. */ const enum WiaImageBias { MaximizeQuality = 131072, - MinimizeSize = 65536 + MinimizeSize = 65536, } /** The WiaImageIntent enumeration helps specify what type of data the image is intended to represent. */ @@ -81,12 +77,12 @@ declare namespace WIA { ColorIntent = 1, GrayscaleIntent = 2, TextIntent = 4, - UnspecifiedIntent = 0 + UnspecifiedIntent = 0, } /** - * The WiaImagePropertyType enumeration specifies the type of the value of an image property. Image properties can be found in the Properties collection o - * f an ImageFile object. + * The WiaImagePropertyType enumeration specifies the type of the value of an image property. Image properties can be found in the Properties collection + * of an ImageFile object. */ const enum WiaImagePropertyType { ByteImagePropertyType = 1001, @@ -103,12 +99,12 @@ declare namespace WIA { VectorOfUndefinedImagePropertyType = 1100, VectorOfUnsignedIntegersImagePropertyType = 1102, VectorOfUnsignedLongsImagePropertyType = 1104, - VectorOfUnsignedRationalsImagePropertyType = 1106 + VectorOfUnsignedRationalsImagePropertyType = 1106, } /** - * An Item's type is composed of bits from the WiaItemFlags enumeration. You can test an Item's type by using the AND operation with Item.Properties("Item - * Flags") and a member from the WiaItemFlags enumeration. + * An Item's type is composed of bits from the WiaItemFlags enumeration. You can test an Item's type by using the AND operation with + * Item.Properties("Item Flags") and a member from the WiaItemFlags enumeration. */ const enum WiaItemFlag { AnalyzeItemFlag = 16, @@ -129,12 +125,12 @@ declare namespace WIA { StorageItemFlag = 4096, TransferItemFlag = 8192, VideoItemFlag = 65536, - VPanoramaItemFlag = 1024 + VPanoramaItemFlag = 1024, } /** - * The WiaPropertyType enumeration specifies the type of the value of an item property. Item properties can be found in the Properties collection of a Dev - * ice or Item object. + * The WiaPropertyType enumeration specifies the type of the value of an item property. Item properties can be found in the Properties collection of a + * Device or Item object. */ const enum WiaPropertyType { BooleanPropertyType = 1, @@ -173,28 +169,31 @@ declare namespace WIA { VectorOfUnsignedIntegersPropertyType = 104, VectorOfUnsignedLargeIntegersPropertyType = 109, VectorOfUnsignedLongsPropertyType = 106, - VectorOfVariantsPropertyType = 119 + VectorOfVariantsPropertyType = 119, } /** - * The WiaSubType enumeration specifies more detail about the property value. Use the SubType property on the Property object to obtain these values for t - * he property. + * The WiaSubType enumeration specifies more detail about the property value. Use the SubType property on the Property object to obtain these values for + * the property. */ const enum WiaSubType { FlagSubType = 3, ListSubType = 2, RangeSubType = 1, - UnspecifiedSubType = 0 + UnspecifiedSubType = 0, } /** * The CommonDialog control is an invisible-at-runtime control that contains all the methods that display a User Interface. A CommonDialog control can be - * created using "WIA.CommonDialog" in a call to CreateObject or by dropping a CommonDialog on a form. + * created using "WIA.CommonDialog" in a call to CreateObject or by dropping a CommonDialog on a form. */ - interface CommonDialog { + class CommonDialog { + private constructor(); + private 'WIA.CommonDialog_typekey': CommonDialog; + /** - * Displays one or more dialog boxes that enable the user to acquire an image from a hardware device for image acquisition and returns an ImageFile object - * on success, otherwise Nothing + * Displays one or more dialog boxes that enable the user to acquire an image from a hardware device for image acquisition and returns an ImageFile + * object on success, otherwise Nothing * @param WIA.WiaDeviceType [DeviceType=0] * @param WIA.WiaImageIntent [Intent=0] * @param WIA.WiaImageBias [Bias=131072] @@ -203,11 +202,11 @@ declare namespace WIA { * @param boolean [UseCommonUI=true] * @param boolean [CancelError=false] */ - ShowAcquireImage( - DeviceType?: WiaDeviceType, Intent?: WiaImageIntent, Bias?: WiaImageBias, FormatID?: string, AlwaysSelectDevice?: boolean, UseCommonUI?: boolean, CancelError?: boolean): ImageFile; + ShowAcquireImage(DeviceType?: WiaDeviceType, Intent?: WiaImageIntent, Bias?: WiaImageBias, FormatID?: string, AlwaysSelectDevice?: boolean, UseCommonUI?: boolean, + CancelError?: boolean): ImageFile | null; /** Launches the Windows Scanner and Camera Wizard and returns Nothing. Future versions may return a collection of ImageFile objects. */ - ShowAcquisitionWizard(Device: Device): any; + ShowAcquisitionWizard(Device: Device): null; /** * Displays the properties dialog box for the specified Device @@ -222,38 +221,41 @@ declare namespace WIA { ShowItemProperties(Item: Item, CancelError?: boolean): void; /** Launches the Photo Printing Wizard with the absolute path of a specific file or Vector of absolute paths to files */ - ShowPhotoPrintingWizard(Files: any): void; + ShowPhotoPrintingWizard(Files: string | Vector): void; /** - * Displays a dialog box that enables the user to select a hardware device for image acquisition. Returns the selected Device object on success, otherwise - * Nothing + * Displays a dialog box that enables the user to select a hardware device for image acquisition. Returns the selected Device object on success, + * otherwise Nothing * @param WIA.WiaDeviceType [DeviceType=0] * @param boolean [AlwaysSelectDevice=false] * @param boolean [CancelError=false] */ - ShowSelectDevice(DeviceType?: WiaDeviceType, AlwaysSelectDevice?: boolean, CancelError?: boolean): Device; + ShowSelectDevice(DeviceType?: WiaDeviceType, AlwaysSelectDevice?: boolean, CancelError?: boolean): Device | null; /** - * Displays a dialog box that enables the user to select an item for transfer from a hardware device for image acquisition. Returns the selection as an It - * ems collection on success, otherwise Nothing + * Displays a dialog box that enables the user to select an item for transfer from a hardware device for image acquisition. Returns the selection as an + * Items collection on success, otherwise Nothing * @param WIA.WiaImageIntent [Intent=0] * @param WIA.WiaImageBias [Bias=131072] * @param boolean [SingleSelect=true] * @param boolean [UseCommonUI=true] * @param boolean [CancelError=false] */ - ShowSelectItems(Device: Device, Intent?: WiaImageIntent, Bias?: WiaImageBias, SingleSelect?: boolean, UseCommonUI?: boolean, CancelError?: boolean): Items; + ShowSelectItems(Device: Device, Intent?: WiaImageIntent, Bias?: WiaImageBias, SingleSelect?: boolean, UseCommonUI?: boolean, CancelError?: boolean): Items | null; /** * Displays a progress dialog box while transferring the specified Item to the local machine. See Item.Transfer for additional information. * @param string [FormatID='{00000000-0000-0000-0000-000000000000}'] * @param boolean [CancelError=false] */ - ShowTransfer(Item: Item, FormatID?: string, CancelError?: boolean): any; + ShowTransfer(Item: Item, FormatID?: string, CancelError?: boolean): ImageFile; } /** The Device object represents an active connection to an imaging device. */ - interface Device { + class Device { + private constructor(); + private 'WIA.Device_typekey': Device; + /** A collection of all commands for this imaging device */ readonly Commands: DeviceCommands; @@ -264,8 +266,8 @@ declare namespace WIA { readonly Events: DeviceEvents; /** - * Issues the command specified by CommandID to the imaging device. CommandIDs are device dependent. Valid CommandIDs for this Device are contained in the - * Commands collection. + * Issues the command specified by CommandID to the imaging device. CommandIDs are device dependent. Valid CommandIDs for this Device are contained in + * the Commands collection. */ ExecuteCommand(CommandID: string): Item; @@ -280,13 +282,13 @@ declare namespace WIA { /** Returns the Type of Device */ readonly Type: WiaDeviceType; - - /** Returns the underlying IWiaItem interface for this Device object */ - readonly WiaItem: any; } /** The DeviceCommand object describes a CommandID that can be used when calling ExecuteCommand on a Device or Item object. */ - interface DeviceCommand { + class DeviceCommand { + private constructor(); + private 'WIA.DeviceCommand_typekey': DeviceCommand; + /** Returns the commandID for this Command */ readonly CommandID: string; @@ -298,8 +300,8 @@ declare namespace WIA { } /** - * The DeviceCommands object is a collection of all the supported DeviceCommands for an imaging device. See the Commands property of a Device or Item obje - * ct for more details on determining the collection of supported device commands. + * The DeviceCommands object is a collection of all the supported DeviceCommands for an imaging device. See the Commands property of a Device or Item + * object for more details on determining the collection of supported device commands. */ interface DeviceCommands { /** Returns the number of members in the collection */ @@ -307,10 +309,16 @@ declare namespace WIA { /** Returns the specified item in the collection by position */ Item(Index: number): DeviceCommand; + + /** Returns the specified item in the collection by position */ + (Index: number): DeviceCommand; } /** The DeviceEvent object describes an EventID that can be used when calling RegisterEvent or RegisterPersistentEvent on a DeviceManager object. */ - interface DeviceEvent { + class DeviceEvent { + private constructor(); + private 'WIA.DeviceEvent_typekey': DeviceEvent; + /** Returns the event Description */ readonly Description: string; @@ -325,8 +333,8 @@ declare namespace WIA { } /** - * The DeviceEvents object is a collection of all the supported DeviceEvent for an imaging device. See the Events property of a Device object for more det - * ails on determining the collection of supported device events. + * The DeviceEvents object is a collection of all the supported DeviceEvent for an imaging device. See the Events property of a Device object for more + * details on determining the collection of supported device events. */ interface DeviceEvents { /** Returns the number of members in the collection */ @@ -334,13 +342,19 @@ declare namespace WIA { /** Returns the specified item in the collection by position */ Item(Index: number): DeviceEvent; + + /** Returns the specified item in the collection by position */ + (Index: number): DeviceEvent; } /** - * The DeviceInfo object is a container that describes the unchanging (static) properties of an imaging device that is currently connected to the computer - * . + * The DeviceInfo object is a container that describes the unchanging (static) properties of an imaging device that is currently connected to the + * computer. */ - interface DeviceInfo { + class DeviceInfo { + private constructor(); + private 'WIA.DeviceInfo_typekey': DeviceInfo; + /** Establish a connection with this device and return a Device object */ Connect(): Device; @@ -355,59 +369,68 @@ declare namespace WIA { } /** - * The DeviceInfos object is a collection of all the imaging devices currently connected to the computer. See the DeviceInfos property on the DeviceManage - * r object for detail on accessing the DeviceInfos object. + * The DeviceInfos object is a collection of all the imaging devices currently connected to the computer. See the DeviceInfos property on the + * DeviceManager object for detail on accessing the DeviceInfos object. */ interface DeviceInfos { /** Returns the number of members in the collection */ readonly Count: number; /** Returns the specified item in the collection either by position or Device ID */ - Item(Index: any): DeviceInfo; + Item(Index: number | string): DeviceInfo; + + /** Returns the specified item in the collection either by position or Device ID */ + (Index: number | string): DeviceInfo; } /** - * The DeviceManager control is an invisible-at-runtime control that manages the imaging devices connected to the computer. A DeviceManager control can be - * created using "WIA.DeviceManager" in a call to CreateObject or by dropping a DeviceManager on a form. + * The DeviceManager control is an invisible-at-runtime control that manages the imaging devices connected to the computer. A DeviceManager control can + * be created using "WIA.DeviceManager" in a call to CreateObject or by dropping a DeviceManager on a form. */ - interface DeviceManager { + class DeviceManager { + private constructor(); + private 'WIA.DeviceManager_typekey': DeviceManager; + /** A collection of all imaging devices connected to this computer */ readonly DeviceInfos: DeviceInfos; /** * Registers the specified EventID for the specified DeviceID. If DeviceID is "*" then OnEvent will be called whenever the event specified occurs for any - * device. Otherwise, OnEvent will only be called if the event specified occurs on the device specified. + * device. Otherwise, OnEvent will only be called if the event specified occurs on the device specified. * @param string [DeviceID='*'] */ RegisterEvent(EventID: string, DeviceID?: string): void; /** - * Registers the specified Command to launch when the specified EventID for the specified DeviceID occurs. Command can be either a ClassID or the full pat - * h name and the appropriate command-line arguments needed to invoke the application. + * Registers the specified Command to launch when the specified EventID for the specified DeviceID occurs. Command can be either a ClassID or the full + * path name and the appropriate command-line arguments needed to invoke the application. * @param string [DeviceID='*'] */ RegisterPersistentEvent(Command: string, Name: string, Description: string, Icon: string, EventID: string, DeviceID?: string): void; /** - * Unregisters the specified EventID for the specified DeviceID. UnregisterEvent should only be called for EventID and DeviceID for which you called Regis - * terEvent. + * Unregisters the specified EventID for the specified DeviceID. UnregisterEvent should only be called for EventID and DeviceID for which you called + * RegisterEvent. * @param string [DeviceID='*'] */ UnregisterEvent(EventID: string, DeviceID?: string): void; /** - * Unregisters the specified Command for the specified EventID for the specified DeviceID. UnregisterPersistentEvent should only be called for the Command - * , Name, Description, Icon, EventID and DeviceID for which you called RegisterPersistentEvent. + * Unregisters the specified Command for the specified EventID for the specified DeviceID. UnregisterPersistentEvent should only be called for the + * Command, Name, Description, Icon, EventID and DeviceID for which you called RegisterPersistentEvent. * @param string [DeviceID='*'] */ UnregisterPersistentEvent(Command: string, Name: string, Description: string, Icon: string, EventID: string, DeviceID?: string): void; } /** - * The Filter object represents a unit of modification on an ImageFile. To use a Filter, add it to the Filters collection, then set the filter's propertie - * s and finally use the Apply method of the ImageProcess object to filter an ImageFile. + * The Filter object represents a unit of modification on an ImageFile. To use a Filter, add it to the Filters collection, then set the filter's + * properties and finally use the Apply method of the ImageProcess object to filter an ImageFile. */ - interface Filter { + class Filter { + private constructor(); + private 'WIA.Filter_typekey': Filter; + /** Returns a Description of what the filter does */ readonly Description: string; @@ -422,10 +445,13 @@ declare namespace WIA { } /** - * The FilterInfo object is a container that describes a Filter object without requiring a Filter to be Added to the process chain. See the FilterInfos pr - * operty on the ImageProcess object for details on accessing FilterInfo objects. + * The FilterInfo object is a container that describes a Filter object without requiring a Filter to be Added to the process chain. See the FilterInfos + * property on the ImageProcess object for details on accessing FilterInfo objects. */ - interface FilterInfo { + class FilterInfo { + private constructor(); + private 'WIA.FilterInfo_typekey': FilterInfo; + /** Returns a technical Description of what the filter does and how to use it in a filter chain */ readonly Description: string; @@ -437,15 +463,18 @@ declare namespace WIA { } /** - * The FilterInfos object is a collection of all the available FilterInfo objects. See the FilterInfos property on the ImageProcess object for detail on a - * ccessing the FilterInfos object. + * The FilterInfos object is a collection of all the available FilterInfo objects. See the FilterInfos property on the ImageProcess object for detail on + * accessing the FilterInfos object. */ interface FilterInfos { /** Returns the number of members in the collection */ readonly Count: number; /** Returns the specified item in the collection either by position or name */ - Item(Index: any): FilterInfo; + Item(Index: number | string): FilterInfo; + + /** Returns the specified item in the collection either by position or name */ + (Index: number | string): FilterInfo; } /** The Filters object is a collection of the Filters that will be applied to an ImageFile when you call the Apply method on the ImageProcess object. */ @@ -464,11 +493,14 @@ declare namespace WIA { /** Removes the designated filter */ Remove(Index: number): void; + + /** Returns the specified item in the collection by position or FilterID */ + (Index: number): Filter; } /** - * The Formats object is a collection of supported FormatIDs that you can use when calling Transfer on an Item object or ShowTransfer on a CommonDialog ob - * ject for this Item. + * The Formats object is a collection of supported FormatIDs that you can use when calling Transfer on an Item object or ShowTransfer on a CommonDialog + * object for this Item. */ interface Formats { /** Returns the number of members in the collection */ @@ -476,13 +508,19 @@ declare namespace WIA { /** Returns the specified item in the collection by position */ Item(Index: number): string; + + /** Returns the specified item in the collection by position */ + (Index: number): string; } /** - * The ImageFile object is a container for images transferred to your computer when you call Transfer or ShowTransfer. It also supports image files throug - * h LoadFile. An ImageFile object can be created using "WIA.ImageFile" in a call to CreateObject. + * The ImageFile object is a container for images transferred to your computer when you call Transfer or ShowTransfer. It also supports image files + * through LoadFile. An ImageFile object can be created using "WIA.ImageFile" in a call to CreateObject. */ - interface ImageFile { + class ImageFile { + private constructor(); + private 'WIA.ImageFile_typekey': ImageFile; + /** Returns/Sets the current frame in the image */ ActiveFrame: number; @@ -539,7 +577,10 @@ declare namespace WIA { } /** The ImageProcess object manages the filter chain. An ImageProcess object can be created using "WIA.ImageProcess" in a call to CreateObject. */ - interface ImageProcess { + class ImageProcess { + private constructor(); + private 'WIA.ImageProcess_typekey': ImageProcess; + /** Takes the specified ImageFile and returns the new ImageFile with all the filters applied on success */ Apply(Source: ImageFile): ImageFile; @@ -551,10 +592,13 @@ declare namespace WIA { } /** - * The Item object is a container for an item on an imaging device object. See the Items property on the Device or Item object for details on accessing It - * em objects. + * The Item object is a container for an item on an imaging device object. See the Items property on the Device or Item object for details on accessing + * Item objects. */ - interface Item { + class Item { + private constructor(); + private 'WIA.Item_typekey': Item; + /** A collection of all commands for this item */ readonly Commands: DeviceCommands; @@ -574,17 +618,15 @@ declare namespace WIA { readonly Properties: Properties; /** - * Returns an ImageFile object, in this version, in the format specified in FormatID if supported, otherwise using the preferred format for this imaging d - * evice. Future versions may return a collection of ImageFile objects. + * Returns an ImageFile object, in this version, in the format specified in FormatID if supported, otherwise using the preferred format for this imaging + * device. Future versions may return a collection of ImageFile objects. * @param string [FormatID='{00000000-0000-0000-0000-000000000000}'] */ - Transfer(FormatID?: string): any; - - /** Returns the underlying IWiaItem interface for this Item object */ - readonly WiaItem: any; + Transfer(FormatID?: string): ImageFile; } /** The Items object contains a collection of Item objects. See the Items property on the Device or Item object for details on accessing the Items object. */ + // tslint:disable-next-line interface-name interface Items { /** Adds a new Item with the specified Name and Flags. The Flags value is created by using the OR operation with members of the WiaItemFlags enumeration. */ Add(Name: string, Flags: number): void; @@ -597,28 +639,37 @@ declare namespace WIA { /** Removes the designated Item */ Remove(Index: number): void; + + /** Returns the specified item in the collection by position */ + (Index: number): Item; } /** - * The Properties object is a collection of all the Property objects associated with a given Device, DeviceInfo, Filter, ImageFile or Item object. See the - * Properties property on any of these objects for detail on accessing the Properties object. + * The Properties object is a collection of all the Property objects associated with a given Device, DeviceInfo, Filter, ImageFile or Item object. See + * the Properties property on any of these objects for detail on accessing the Properties object. */ interface Properties { /** Returns the number of members in the collection */ readonly Count: number; /** Indicates whether the specified Property exists in the collection */ - Exists(Index: any): boolean; + Exists(Index: number | string): boolean; /** Returns the specified item in the collection either by position or name. */ - Item(Index: any): Property; + Item(Index: number | string): Property; + + /** Returns the specified item in the collection either by position or name. */ + (Index: number | string): Property; } /** - * The Property object is a container for a property associated with a Device, DeviceInfo, Filter, ImageFile or Item object. See the Properties property o - * n any of these objects for details on accessing Property objects. + * The Property object is a container for a property associated with a Device, DeviceInfo, Filter, ImageFile or Item object. See the Properties property + * on any of these objects for details on accessing Property objects. */ - interface Property { + class Property { + private constructor(); + private 'WIA.Property_typekey': Property; + /** Indicates whether the Property Value is read only */ readonly IsReadOnly: boolean; @@ -657,10 +708,13 @@ declare namespace WIA { } /** - * The Rational object is a container for the rational values found in Exif tags. It is a supported element type of the Vector object and may be created u - * sing "WIA.Rational" in a call to CreateObject. + * The Rational object is a container for the rational values found in Exif tags. It is a supported element type of the Vector object and may be created + * using "WIA.Rational" in a call to CreateObject. */ - interface Rational { + class Rational { + private constructor(); + private 'WIA.Rational_typekey': Rational; + /** Returns/Sets the Rational Value Denominator */ Denominator: number; @@ -672,19 +726,19 @@ declare namespace WIA { } /** - * The Vector object is a collection of values of the same type. It is used throughout the library in many different ways. The Vector object may be create - * d using "WIA.Vector" in a call to CreateObject. + * The Vector object is a collection of values of the same type. It is used throughout the library in many different ways. The Vector object may be + * created using "WIA.Vector" in a call to CreateObject. */ - interface Vector { + interface Vector { /** - * If Index is not zero, Inserts a new element into the Vector collection before the specified Index. If Index is zero, Appends a new element to the Vecto - * r collection. + * If Index is not zero, Inserts a new element into the Vector collection before the specified Index. If Index is zero, Appends a new element to the + * Vector collection. * @param number [Index=0] */ - Add(Value: any, Index?: number): void; + Add(Value: TItem, Index?: number): void; /** Returns/Sets the Vector of Bytes as an array of bytes */ - BinaryData: any; + BinaryData: SafeArray; /** Removes all elements. */ Clear(): void; @@ -696,30 +750,30 @@ declare namespace WIA { Date: VarDate; /** - * Used to get the Thumbnail property of an ImageFile which is an image file, The thumbnail property of an Item which is RGB data, or creating an ImageFil - * e from raw ARGB data. Returns an ImageFile object on success. See the Picture method for more details. + * Used to get the Thumbnail property of an ImageFile which is an image file, The thumbnail property of an Item which is RGB data, or creating an + * ImageFile from raw ARGB data. Returns an ImageFile object on success. See the Picture method for more details. * @param number [Width=0] * @param number [Height=0] */ ImageFile(Width?: number, Height?: number): ImageFile; - /** Returns/Sets the specified item in the vector by position */ - Item(Index: number): any; + /** Returns the specified item in the vector by position */ + Item(Index: number): TItem; /** - * If the Vector of Bytes contains an image file, then Width and Height are ignored. Otherwise a Vector of Bytes must be RGB data and a Vector of Longs mu - * st be ARGB data. Returns a Picture object on success. See the ImageFile method for more details. + * If the Vector of Bytes contains an image file, then Width and Height are ignored. Otherwise a Vector of Bytes must be RGB data and a Vector of Longs + * must be ARGB data. Returns a Picture object on success. See the ImageFile method for more details. * @param number [Width=0] * @param number [Height=0] */ Picture(Width?: number, Height?: number): any; /** Removes the designated element and returns it if successful */ - Remove(Index: number): any; + Remove(Index: number): TItem | null; /** - * Stores the string Value into the Vector of Bytes including the NULL terminator. Value may be truncated unless Resizable is True. The string will be sto - * red as an ANSI string unless Unicode is True, in which case it will be stored as a Unicode string. + * Stores the string Value into the Vector of Bytes including the NULL terminator. Value may be truncated unless Resizable is True. The string will be + * stored as an ANSI string unless Unicode is True, in which case it will be stored as a Unicode string. * @param boolean [Resizable=true] * @param boolean [Unicode=true] */ @@ -730,30 +784,24 @@ declare namespace WIA { * @param boolean [Unicode=true] */ String(Unicode?: boolean): string; + + /** Returns the specified item in the vector by position */ + (Index: number): TItem; } } interface ActiveXObject { + new(progid: K): ActiveXObjectNameMap[K]; on(obj: WIA.DeviceManager, event: 'OnEvent', argNames: ['EventID', 'DeviceID', 'ItemID'], handler: ( - this: WIA.DeviceManager, parameter: { - EventID: string, DeviceID: string, ItemID: string}) => void): void; - set(obj: WIA.Vector, propertyName: 'Item', parameterTypes: [number], newValue: any): void; - new(progid: 'WIA.CommonDialog'): WIA.CommonDialog; - new(progid: 'WIA.DeviceManager'): WIA.DeviceManager; - new(progid: 'WIA.ImageFile'): WIA.ImageFile; - new(progid: 'WIA.ImageProcess'): WIA.ImageProcess; - new(progid: 'WIA.Rational'): WIA.Rational; - new(progid: 'WIA.Vector'): WIA.Vector; + this: WIA.DeviceManager, parameter: { readonly EventID: string, readonly DeviceID: string, readonly ItemID: string }) => void): void; + set(obj: WIA.Vector, propertyName: 'Item', parameterTypes: [number], newValue: TItem): void; } -interface EnumeratorConstructor { - new(col: WIA.DeviceCommands): WIA.DeviceCommand; - new(col: WIA.DeviceEvents): WIA.DeviceEvent; - new(col: WIA.DeviceInfos): WIA.DeviceInfo; - new(col: WIA.FilterInfos): WIA.FilterInfo; - new(col: WIA.Filters): WIA.Filter; - new(col: WIA.Formats): string; - new(col: WIA.Items): WIA.Item; - new(col: WIA.Properties): WIA.Property; - new(col: WIA.Vector): any; +interface ActiveXObjectNameMap { + 'WIA.CommonDialog': WIA.CommonDialog; + 'WIA.DeviceManager': WIA.DeviceManager; + 'WIA.ImageFile': WIA.ImageFile; + 'WIA.ImageProcess': WIA.ImageProcess; + 'WIA.Rational': WIA.Rational; + 'WIA.Vector': WIA.Vector; } diff --git a/types/activex-wia/tslint.json b/types/activex-wia/tslint.json index 3224b40b8b..457cebbb55 100644 --- a/types/activex-wia/tslint.json +++ b/types/activex-wia/tslint.json @@ -1,6 +1,6 @@ { "extends": "dtslint/dt.json", - "rules": { + "rules":{ "no-const-enum": false } } diff --git a/types/amphtml-validator/amphtml-validator-tests.ts b/types/amphtml-validator/amphtml-validator-tests.ts new file mode 100644 index 0000000000..4160f7a451 --- /dev/null +++ b/types/amphtml-validator/amphtml-validator-tests.ts @@ -0,0 +1,28 @@ +import * as ampHtmlValidator from "amphtml-validator"; + +(async () => { + const validator = await ampHtmlValidator.getInstance(); + const result = validator.validateString(""); + const { status, errors } = result; + if (status === "FAIL" || status === "UNKNOWN") { + const errs = errors.map(err => { + const { + severity, + line, + col, + message, + specUrl, + category, + code, + params + } = err; + return err; + }); + } +})(); + +(() => { + const validator = ampHtmlValidator.newInstance(""); + const result = validator.validateString(""); + const { status, errors } = result; +})(); diff --git a/types/amphtml-validator/index.d.ts b/types/amphtml-validator/index.d.ts new file mode 100644 index 0000000000..bcf8e5d66e --- /dev/null +++ b/types/amphtml-validator/index.d.ts @@ -0,0 +1,156 @@ +// Type definitions for amphtml-validator 1.0 +// Project: https://github.com/ampproject/amphtml/tree/master/validator/nodejs +// Definitions by: Kevin Tjiam +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +import { Context, Script } from "vm"; + +export interface ValidationError { + severity: ValidationErrorSeverity; + line: number; + col: number; + message: string; + specUrl: string | null; + category: ErrorCategoryCode; + code: ValidationErrorCode; + params: string[]; +} + +export interface ValidationResult { + status: ValidationResultStatus; + errors: ValidationError[]; +} + +export class Validator extends Script { + sandbox: Context; + validateString(stringToValidate: string): ValidationResult; +} + +export function getInstance( + validatorJs?: string, + userAgent?: string +): Promise; +export function newInstance(validatorJsContents: string): Validator; + +/** + * Enums from protobufs + * https://github.com/ampproject/amphtml/blob/master/validator/validator.proto + */ +export type ValidationResultStatus = "UNKNOWN" | "PASS" | "FAIL"; + +export type ValidationErrorSeverity = "UNKNOWN_SEVERITY" | "ERROR" | "WARNING"; + +export type ErrorCategoryCode = + | "UNKNOWN" + | "GENERIC" + | "DISALLOWED_HTML_WITH_AMP_EQUIVALENT" + | "DISALLOWED_HTML" + | "AUTHOR_STYLESHEET_PROBLEM" + | "MANDATORY_AMP_TAG_MISSING_OR_INCORRECT" + | "AMP_TAG_PROBLEM" + | "CUSTOM_JAVASCRIPT_DISALLOWED" + | "AMP_LAYOUT_PROBLEM" + | "AMP_HTML_TEMPLATE_PROBLEM" + | "DEPRECATION"; + +export type ValidationErrorCode = + | "UNKNOWN_CODE" + | "MANDATORY_TAG_MISSING" + | "TAG_REQUIRED_BY_MISSING" + | "WARNING_TAG_REQUIRED_BY_MISSING" + | "WARNING_EXTENSION_UNUSED" + | "EXTENSION_UNUSED" + | "WARNING_EXTENSION_DEPRECATED_VERSION" + | "ATTR_REQUIRED_BUT_MISSING" + | "DISALLOWED_TAG" + | "GENERAL_DISALLOWED_TAG" + | "DISALLOWED_SCRIPT_TAG" + | "DISALLOWED_ATTR" + | "DISALLOWED_STYLE_ATTR" + | "INVALID_ATTR_VALUE" + | "DUPLICATE_ATTRIBUTE" + | "ATTR_VALUE_REQUIRED_BY_LAYOUT" + | "IMPLIED_LAYOUT_INVALID" + | "SPECIFIED_LAYOUT_INVALID" + | "MANDATORY_ATTR_MISSING" + | "MANDATORY_ONEOF_ATTR_MISSING" + | "DUPLICATE_DIMENSION" + | "DUPLICATE_UNIQUE_TAG" + | "DUPLICATE_UNIQUE_TAG_WARNING" + | "WRONG_PARENT_TAG" + | "STYLESHEET_TOO_LONG" + | "MANDATORY_CDATA_MISSING_OR_INCORRECT" + | "CDATA_VIOLATES_BLACKLIST" + | "NON_WHITESPACE_CDATA_ENCOUNTERED" + | "DEPRECATED_ATTR" + | "DEPRECATED_TAG" + | "MANDATORY_PROPERTY_MISSING_FROM_ATTR_VALUE" + | "INVALID_PROPERTY_VALUE_IN_ATTR_VALUE" + | "MISSING_URL" + | "INVALID_URL" + | "INVALID_URL_PROTOCOL" + | "DISALLOWED_DOMAIN" + | "DISALLOWED_RELATIVE_URL" + | "DISALLOWED_PROPERTY_IN_ATTR_VALUE" + | "MUTUALLY_EXCLUSIVE_ATTRS" + | "UNESCAPED_TEMPLATE_IN_ATTR_VALUE" + | "TEMPLATE_PARTIAL_IN_ATTR_VALUE" + | "TEMPLATE_IN_ATTR_NAME" + | "INCONSISTENT_UNITS_FOR_WIDTH_AND_HEIGHT" + | "DISALLOWED_TAG_ANCESTOR" + | "MANDATORY_LAST_CHILD_TAG" + | "MANDATORY_TAG_ANCESTOR" + | "MANDATORY_TAG_ANCESTOR_WITH_HINT" + | "ATTR_DISALLOWED_BY_IMPLIED_LAYOUT" + | "ATTR_DISALLOWED_BY_SPECIFIED_LAYOUT" + | "INCORRECT_NUM_CHILD_TAGS" + | "INCORRECT_MIN_NUM_CHILD_TAGS" + | "DISALLOWED_CHILD_TAG_NAME" + | "DISALLOWED_FIRST_CHILD_TAG_NAME" + | "DISALLOWED_MANUFACTURED_BODY" + | "CHILD_TAG_DOES_NOT_SATISFY_REFERENCE_POINT" + | "MANDATORY_REFERENCE_POINT_MISSING" + | "DUPLICATE_REFERENCE_POINT" + | "TAG_NOT_ALLOWED_TO_HAVE_SIBLINGS" + | "TAG_REFERENCE_POINT_CONFLICT" + | "CHILD_TAG_DOES_NOT_SATISFY_REFERENCE_POINT_SINGULAR" + | "BASE_TAG_MUST_PRECEED_ALL_URLS" + | "MISSING_REQUIRED_EXTENSION" + | "ATTR_MISSING_REQUIRED_EXTENSION" + | "DOCUMENT_TOO_COMPLEX" + | "INVALID_UTF8" + | "CSS_SYNTAX" + | "CSS_SYNTAX_INVALID_AT_RULE" + | "CSS_SYNTAX_STRAY_TRAILING_BACKSLASH" + | "CSS_SYNTAX_UNTERMINATED_COMMENT" + | "CSS_SYNTAX_UNTERMINATED_STRING" + | "CSS_SYNTAX_BAD_URL" + | "CSS_SYNTAX_EOF_IN_PRELUDE_OF_QUALIFIED_RULE" + | "CSS_SYNTAX_INVALID_DECLARATION" + | "CSS_SYNTAX_INCOMPLETE_DECLARATION" + | "CSS_SYNTAX_ERROR_IN_PSEUDO_SELECTOR" + | "CSS_SYNTAX_MISSING_SELECTOR" + | "CSS_SYNTAX_NOT_A_SELECTOR_START" + | "CSS_SYNTAX_UNPARSED_INPUT_REMAINS_IN_SELECTOR" + | "CSS_SYNTAX_MISSING_URL" + | "CSS_SYNTAX_INVALID_URL" + | "CSS_SYNTAX_INVALID_URL_PROTOCOL" + | "CSS_SYNTAX_DISALLOWED_DOMAIN" + | "CSS_SYNTAX_DISALLOWED_RELATIVE_URL" + | "CSS_SYNTAX_INVALID_ATTR_SELECTOR" + | "CSS_SYNTAX_INVALID_PROPERTY" + | "CSS_SYNTAX_INVALID_PROPERTY_NOLIST" + | "CSS_SYNTAX_QUALIFIED_RULE_HAS_NO_DECLARATIONS" + | "CSS_SYNTAX_DISALLOWED_QUALIFIED_RULE_MUST_BE_INSIDE_KEYFRAME" + | "CSS_SYNTAX_DISALLOWED_KEYFRAME_INSIDE_KEYFRAME" + | "CSS_SYNTAX_MALFORMED_MEDIA_QUERY" + | "CSS_SYNTAX_DISALLOWED_MEDIA_TYPE" + | "CSS_SYNTAX_DISALLOWED_MEDIA_FEATURE" + | "CSS_SYNTAX_DISALLOWED_PROPERTY_VALUE" + | "CSS_SYNTAX_DISALLOWED_PROPERTY_VALUE_WITH_HINT" + | "CSS_SYNTAX_PROPERTY_DISALLOWED_WITHIN_AT_RULE" + | "CSS_SYNTAX_PROPERTY_DISALLOWED_TOGETHER_WITH" + | "CSS_SYNTAX_PROPERTY_REQUIRES_QUALIFICATION"; diff --git a/types/amphtml-validator/tsconfig.json b/types/amphtml-validator/tsconfig.json new file mode 100644 index 0000000000..0c0c91b549 --- /dev/null +++ b/types/amphtml-validator/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", "amphtml-validator-tests.ts"] +} diff --git a/types/amphtml-validator/tslint.json b/types/amphtml-validator/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/amphtml-validator/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/amqp/index.d.ts b/types/amqp/index.d.ts index ca39ce4404..4e2cd4e288 100644 --- a/types/amqp/index.d.ts +++ b/types/amqp/index.d.ts @@ -96,6 +96,7 @@ export interface ConnectionOptions { authMechanism?: string; vhost?: string; noDelay?: boolean; + heartbeat?: number; ssl?: { enabled: boolean; keyFile?: string; diff --git a/types/async-lock/async-lock-tests.ts b/types/async-lock/async-lock-tests.ts index c6866d270b..9e8920ca4b 100644 --- a/types/async-lock/async-lock-tests.ts +++ b/types/async-lock/async-lock-tests.ts @@ -1,4 +1,3 @@ - import * as AsyncLock from "async-lock"; const lock = new AsyncLock(); @@ -6,9 +5,9 @@ lock.acquire("key", (done) => { done(); }, (err, ret) => { /* ... */ }); -lock.acquire("key", (done) => { - done(); -}).then(() => { /* ... */ }); +lock.acquire("key", (done) => { done(); }) + .then(() => { /* ... */ }) + .catch(() => { /* ... */ }); lock.acquire("key", () => "stringValue") // Check returned value's type is inherited properly @@ -23,6 +22,7 @@ lock.acquire([ "key1", "key2" ], (done) => { }, (err, ret) => { /* ... */ }); lock.isBusy(); +lock.isBusy('key'); const lock2 = new AsyncLock({ timeout : 5000 }); const lock3 = new AsyncLock({ maxPending : 5000 }); diff --git a/types/async-lock/index.d.ts b/types/async-lock/index.d.ts index 5527482748..cd2b1e4b40 100644 --- a/types/async-lock/index.d.ts +++ b/types/async-lock/index.d.ts @@ -1,13 +1,12 @@ -// Type definitions for async-lock +// Type definitions for async-lock 1.1 // Project: https://github.com/rain1017/async-lock -// Definitions by: Elisée MAURER , Alejandro +// Definitions by: Elisée MAURER +// Alejandro +// Anatoly // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 - -interface AsyncLockDoneCallback { - (err?: Error, ret?: T): void; -} +type AsyncLockDoneCallback = (err?: Error, ret?: T) => void; interface AsyncLockOptions { timeout?: number; @@ -21,13 +20,13 @@ declare class AsyncLock { acquire(key: string | string[], fn: (() => T | PromiseLike) | ((done: AsyncLockDoneCallback) => any), - opts?: AsyncLockOptions): PromiseLike; + opts?: AsyncLockOptions): Promise; acquire(key: string | string[], fn: (done: AsyncLockDoneCallback) => any, cb: AsyncLockDoneCallback, opts?: AsyncLockOptions): void; - isBusy(): boolean; + isBusy(key?: string): boolean; } declare namespace AsyncLock { } diff --git a/types/async-lock/tslint.json b/types/async-lock/tslint.json index 35039ba334..f93cf8562a 100644 --- a/types/async-lock/tslint.json +++ b/types/async-lock/tslint.json @@ -1,77 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } + "extends": "dtslint/dt.json" } diff --git a/types/atlaskit__button/atlaskit__button-tests.tsx b/types/atlaskit__button/atlaskit__button-tests.tsx new file mode 100644 index 0000000000..dd592255e9 --- /dev/null +++ b/types/atlaskit__button/atlaskit__button-tests.tsx @@ -0,0 +1,38 @@ +import Button, { ButtonGroup, themeNamespace } from "@atlaskit/button"; + +import * as React from "react"; +import { render } from "react-dom"; + +declare const container: Element; + +render( + + + , + container +); diff --git a/types/atlaskit__button/index.d.ts b/types/atlaskit__button/index.d.ts new file mode 100644 index 0000000000..e9a613fabd --- /dev/null +++ b/types/atlaskit__button/index.d.ts @@ -0,0 +1,93 @@ +// Type definitions for @atlaskit/button 6.4 +// Project: https://bitbucket.org/atlassian/atlaskit-mk-2/ +// Definitions by: Jimmy Luong +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import { + Component, + ReactNode, + ReactElement, + ComponentClass, + MouseEventHandler +} from "react"; + +export type ButtonAppearances = + | "default" + | "danger" + | "link" + | "primary" + | "subtle" + | "subtle-link" + | "warning" + | "help"; + +export interface ButtonProps { + /** The base styling to apply to the button. */ + readonly appearance?: ButtonAppearances; + /** Pass aria-controls to underlying html button. */ + readonly ariaControls?: string; + /** Pass aria-expanded to underlying html button. */ + readonly ariaExpanded?: boolean; + /** Pass aria-haspopup to underlying html button. */ + readonly ariaHaspopup?: boolean; + /** This button's child nodes. */ + readonly children?: ReactNode; + /** Add a classname to the button. */ + readonly className?: string; + /** A custom component to use instead of the default button. */ + readonly component?: ComponentClass; + /** Name property of a linked form that the button submits when clicked. */ + readonly form?: string; + /** Provides a url for buttons being used as a link. */ + readonly href?: string; + /** Places an icon within the button, after the button's text. */ + readonly iconAfter?: ReactElement; + /** Places an icon within the button, before the button's text. */ + readonly iconBefore?: ReactElement; + /** Pass a reference on to the styled component */ + readonly innerRef?: (instance: any) => void; + /** Provide a unique id to the button. */ + readonly id?: string; + /** Set if the button is disabled. */ + readonly isDisabled?: boolean; + /** Change the style to indicate the button is selected. */ + readonly isSelected?: boolean; + /** Handler to be called on click. */ + readonly onClick?: MouseEventHandler; + /** Set the amount of padding in the button. */ + readonly spacing?: ButtonSpacing; + /** Assign specific tabIndex order to the underlying html button. */ + readonly tabIndex?: number; + /** Pass target down to a link within the button component, if a href is provided. */ + readonly target?: string; + /** Set whether it is a button or a form submission. */ + readonly type?: ButtonType; + /** Option to fit button width to its parent width */ + readonly shouldFitContainer?: boolean; +} + +export type ButtonType = "button" | "submit"; + +export type ButtonSpacing = "compact" | "default" | "none"; + +export interface ButtonState { + readonly isActive: boolean; + readonly isFocus: boolean; + readonly isHover: boolean; +} + +declare class Button extends Component {} + +export interface ButtonGroupProps { + /** The appearance to apply to all buttons. */ + readonly appearance?: ButtonAppearances; + /** The buttons to render. */ + readonly children: ReactNode; +} + +export class ButtonGroup extends Component {} + +export const themeNamespace: string; + +export default Button; diff --git a/types/atlaskit__button/tsconfig.json b/types/atlaskit__button/tsconfig.json new file mode 100644 index 0000000000..3f374a6b3e --- /dev/null +++ b/types/atlaskit__button/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6", "dom"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react", + "paths": { + "@atlaskit/button": ["atlaskit__button"] + } + }, + "files": ["index.d.ts", "atlaskit__button-tests.tsx"] +} diff --git a/types/atlaskit__button/tslint.json b/types/atlaskit__button/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/atlaskit__button/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/atom/linter/index.d.ts b/types/atom/linter/index.d.ts index 79fc397ab8..72f378af26 100644 --- a/types/atom/linter/index.d.ts +++ b/types/atom/linter/index.d.ts @@ -5,6 +5,10 @@ import { Disposable, Point, Range, TextEditor } from "../index"; +export interface Config { + name: string; +} + export interface ReplacementSolution { title?: string; position: Range; @@ -60,6 +64,9 @@ export interface Message { * do things like HTTP requests. */ description?: string|(() => Promise|string); + + /** Optionally override the displayed linter name. Defaults to provider name. */ + linterName?: string; } export interface IndieDelegate { @@ -73,10 +80,14 @@ export interface IndieDelegate { dispose(): void; } +export type LintResult = Message[] | null; + export interface LinterProvider { name: string; scope: "file"|"project"; lintsOnChange: boolean; grammarScopes: string[]; - lint(textEditor: TextEditor): Message[]|null|Promise; + lint(editor: TextEditor): LintResult | Promise; } + +export type IndieProvider = (register: (config: Config) => IndieDelegate) => void; diff --git a/types/aws-lambda/aws-lambda-tests.ts b/types/aws-lambda/aws-lambda-tests.ts index bd29160912..2b7b375576 100644 --- a/types/aws-lambda/aws-lambda-tests.ts +++ b/types/aws-lambda/aws-lambda-tests.ts @@ -631,7 +631,15 @@ let apiGtwProxyHandler: AWSLambda.APIGatewayProxyHandler = (event: AWSLambda.API let proxyHandler: AWSLambda.ProxyHandler = (event: AWSLambda.APIGatewayEvent, context: AWSLambda.Context, cb: AWSLambda.ProxyCallback) => { }; apiGtwProxyHandler = proxyHandler; -let cloudFrontRequestHandler: AWSLambda.CloudFrontRequestHandler = (event: AWSLambda.CloudFrontRequestEvent, context: AWSLambda.Context, cb: AWSLambda.CloudFrontRequestCallback) => { }; +let cloudFrontRequestHandler: AWSLambda.CloudFrontRequestHandler = (event: AWSLambda.CloudFrontRequestEvent, context: AWSLambda.Context, cb: AWSLambda.CloudFrontRequestCallback) => { + cb(); + cb(null); + cb(new Error('')); + cb(null, { clientIp: str, method: str, uri: str, querystring: str, headers: { } }); + cb(null, { status: str }); + // $ExpectError + cb(null, { }); +}; let cloudFrontResponseHandler: AWSLambda.CloudFrontResponseHandler = (event: AWSLambda.CloudFrontResponseEvent, context: AWSLambda.Context, cb: AWSLambda.CloudFrontResponseCallback) => { }; diff --git a/types/aws-lambda/index.d.ts b/types/aws-lambda/index.d.ts index 03910b108c..eccc96ba3e 100644 --- a/types/aws-lambda/index.d.ts +++ b/types/aws-lambda/index.d.ts @@ -15,6 +15,7 @@ // Palmi Valgeirsson // Danilo Raisi // Simon Buchan +// David Hayden // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -516,7 +517,7 @@ export interface CloudFrontResponseEvent { }>; } -export type CloudFrontRequestResult = undefined | null | CloudFrontResultResponse; +export type CloudFrontRequestResult = undefined | null | CloudFrontResultResponse | CloudFrontRequest; export interface CloudFrontRequestEvent { Records: Array<{ diff --git a/types/babel-types/index.d.ts b/types/babel-types/index.d.ts index cbed3e076c..b1de338923 100644 --- a/types/babel-types/index.d.ts +++ b/types/babel-types/index.d.ts @@ -422,7 +422,7 @@ export interface ExportNamedDeclaration extends Node { type: "ExportNamedDeclaration"; declaration: Declaration; specifiers: ExportSpecifier[]; - source: StringLiteral; + source: StringLiteral | null; } export interface ExportSpecifier extends Node { diff --git a/types/babel__code-frame/babel__code-frame-tests.ts b/types/babel__code-frame/babel__code-frame-tests.ts new file mode 100644 index 0000000000..380134532e --- /dev/null +++ b/types/babel__code-frame/babel__code-frame-tests.ts @@ -0,0 +1,26 @@ +import codeFrame, { codeFrameColumns } from "@babel/code-frame"; + +const code = ` + const number = 1; + var string = 'foo'; + + function print(name: string) { + console.log(string + name); + } +`; + +codeFrame(code, 5, 22); +codeFrame(code, 5, 22, { forceColor: true }); +codeFrame(code, 2, 2, { highlightCode: true }); + +codeFrameColumns(code, { start: { line: 5, column: 22 } }); +codeFrameColumns( + code, + { start: { line: 5, column: 22 } }, + { forceColor: true } +); +codeFrameColumns( + code, + { start: { line: 2, column: 2 } }, + { highlightCode: true } +); diff --git a/types/babel__code-frame/index.d.ts b/types/babel__code-frame/index.d.ts new file mode 100644 index 0000000000..5a32040bb2 --- /dev/null +++ b/types/babel__code-frame/index.d.ts @@ -0,0 +1,54 @@ +// Type definitions for @babel/code-frame 7.0 +// Project: https://github.com/babel/babel/tree/master/packages/babel-code-frame +// Definitions by: Mohsen Azimi +// Forbes Lindesay +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface SourceLocation { + start: { line: number; column?: number }; + end?: { line: number; column?: number }; +} +export function codeFrameColumns( + rawLines: string, + location: SourceLocation, + options?: BabelCodeFrameOptions +): string; + +export interface BabelCodeFrameOptions { + /** Syntax highlight the code as JavaScript for terminals. default: false */ + highlightCode?: boolean; + /** The number of lines to show above the error. default: 2 */ + linesAbove?: number; + /** The number of lines to show below the error. default: 3 */ + linesBelow?: number; + /** + * Forcibly syntax highlight the code as JavaScript (for non-terminals); + * overrides highlightCode. + * default: false + */ + forceColor?: boolean; + /** + * Pass in a string to be displayed inline (if possible) next to the + * highlighted location in the code. If it can't be positioned inline, + * it will be placed above the code frame. + * default: nothing + */ + message?: string; +} + +/** + * Generate errors that contain a code frame that point to source locations. + * + * @param rawLines Raw lines to frame + * @param lineNumber Line number (1 indexed) + * @param colNumber Column number + * @param options Additional options + * + * @returns Framed code + */ +export default function codeFrame( + rawLines: string, + lineNumber: number, + colNumber: number, + options?: BabelCodeFrameOptions +): string; diff --git a/types/babel__code-frame/tsconfig.json b/types/babel__code-frame/tsconfig.json new file mode 100644 index 0000000000..49bd833b58 --- /dev/null +++ b/types/babel__code-frame/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "paths": { + "@babel/code-frame": ["babel__code-frame"] + } + }, + "files": ["index.d.ts", "babel__code-frame-tests.ts"] +} diff --git a/types/babel__code-frame/tslint.json b/types/babel__code-frame/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/babel__code-frame/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/base64topdf/base64topdf-tests.ts b/types/base64topdf/base64topdf-tests.ts new file mode 100644 index 0000000000..109ec5fbff --- /dev/null +++ b/types/base64topdf/base64topdf-tests.ts @@ -0,0 +1,8 @@ +import * as base64topdf from 'base64topdf'; + +base64topdf.base64Encode('index.ts'); // $ExpectType void +base64topdf.base64Decode('decodethis', 'test.b64'); // $ExpectType void +base64topdf.rtfToText('rtf'); // $ExpectType string +base64topdf.textToRtf('text'); // $ExpectType string +base64topdf.strToBase64('str'); // $ExpectType string +base64topdf.base64ToStr('base64'); // $ExpectType string diff --git a/types/base64topdf/index.d.ts b/types/base64topdf/index.d.ts new file mode 100644 index 0000000000..97f9af7077 --- /dev/null +++ b/types/base64topdf/index.d.ts @@ -0,0 +1,13 @@ +// Type definitions for base64topdf 1.1 +// Project: https://github.com/rpsankar001 +// Definitions by: Lucas Riondel +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export as namespace base64topdf; + +export function base64Encode(file: string): void; +export function base64Decode(base64str: string, file: string): void; +export function rtfToText(rtfStr: string): string; +export function textToRtf(textStr: string): string; +export function strToBase64(str: string): string; +export function base64ToStr(base64Str: string): string; diff --git a/types/base64topdf/tsconfig.json b/types/base64topdf/tsconfig.json new file mode 100644 index 0000000000..29fb459eb9 --- /dev/null +++ b/types/base64topdf/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", + "base64topdf-tests.ts" + ] +} diff --git a/types/base64topdf/tslint.json b/types/base64topdf/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/base64topdf/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/bootstrap-datepicker/index.d.ts b/types/bootstrap-datepicker/index.d.ts index a1beefa467..dfe358854e 100644 --- a/types/bootstrap-datepicker/index.d.ts +++ b/types/bootstrap-datepicker/index.d.ts @@ -58,6 +58,7 @@ interface DatepickerOptions { daysOfWeekHighlighted?:string|number[]; defaultViewDate?:Date|string|DatepickerViewDate; updateViewDate?:boolean; + enableOnReadonly?: boolean; } interface DatepickerViewDate { diff --git a/types/canvas-confetti/canvas-confetti-tests.ts b/types/canvas-confetti/canvas-confetti-tests.ts new file mode 100644 index 0000000000..d29e57fbdb --- /dev/null +++ b/types/canvas-confetti/canvas-confetti-tests.ts @@ -0,0 +1,45 @@ +import confetti = require("canvas-confetti"); + +confetti.Promise = null; + +confetti(); + +confetti({ + particleCount: 150 +}); + +confetti({ + spread: 180 +}); + +confetti({ + particleCount: 100, + startVelocity: 30, + spread: 360, + origin: { + x: Math.random(), + // since they fall down, start a bit higher than random + y: Math.random() - 0.2 + } +}); + +confetti({ + particleCount: 100, + spread: 70, + origin: { + y: 0.6 + } +}); + +function r(min: number, max: number) { + return Math.random() * (max - min) + min; +} + +confetti({ + angle: r(55, 125), + spread: r(50, 70), + particleCount: r(50, 100), + origin: { + y: 0.6 + } +}); diff --git a/types/canvas-confetti/index.d.ts b/types/canvas-confetti/index.d.ts new file mode 100644 index 0000000000..3dddc6d750 --- /dev/null +++ b/types/canvas-confetti/index.d.ts @@ -0,0 +1,86 @@ +// Type definitions for canvas-confetti 0.0 +// Project: https://github.com/catdad/canvas-confetti#readme +// Definitions by: Martin Tracey +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * `confetti` takes a single optional object. When `window.Promise` is available, it will return a Promise to let you know when it is done. When promises are not available (like in IE), it will return + * `null`. You can polyfill promises using any of the popular polyfills. You can also provide a custom promise implementation to `confetti` through: + * + * `const MyPromise = require('some-promise-lib'); + * const confetti = require('canvas-confetti'); + * confetti.Promise = MyPromise;` + * + * If you call `confetti` multiple times before it is done, it + * will return the same promise every time. Internally, the same canvas element will be reused, continuing the existing animation with the new confetti added. The promise returned by each call to + * `confetti` will resolve once all animations are done. + * + */ +declare function confetti(options?: confetti.Options): Promise | null; + +declare namespace confetti { + /** + * You can polyfill promises using any of the popular polyfills. You can also provide a promise implementation to `confetti` through this property. + */ + let Promise: any; + + interface Options { + /** + * The number of confetti to launch. More is always fun... but be cool, there's a lot of math involved. + * @default 50 + */ + particleCount?: number; + /** + * The angle in which to launch the confetti, in degrees. 90 is straight up. + * @default 90 + */ + angle?: number; + /** + * How far off center the confetti can go, in degrees. 45 means the confetti will launch at the defined angle plus or minus 22.5 degrees. + * @default 45 + */ + spread?: number; + /** + * How fast the confetti will start going, in pixels. + * @default 45 + */ + startVelocity?: number; + /** + * How quickly the confetti will lose speed. Keep this number between 0 and 1, otherwise the confetti will gain speed. Better yet, just never change it. + * @default 0.9 + */ + decay?: number; + /** + * How many times the confetti will move. This is abstract... but play with it if the confetti disappear too quickly for you. + * @default 200 + */ + ticks?: number; + /** + * Where to start firing confetti from. Feel free to launch off-screen if you'd like. + */ + origin?: Origin; + /** + * An array of color strings, in the HEX format... you know, like #bada55. + */ + colors?: string[]; + /** + * The confetti should be on top, after all. But if you have a crazy high page, you can set it even higher. + * @default 100 + */ + zIndex?: number; + } + interface Origin { + /** + * The x position on the page, with 0 being the left edge and 1 being the right edge. + * @default 0.5 + */ + x?: number; + /** + * The y position on the page, with 0 being the left edge and 1 being the right edge. + * @default 0.5 + */ + y?: number; + } +} + +export = confetti; diff --git a/types/canvas-confetti/tsconfig.json b/types/canvas-confetti/tsconfig.json new file mode 100644 index 0000000000..33c159b3e3 --- /dev/null +++ b/types/canvas-confetti/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", + "canvas-confetti-tests.ts" + ] +} diff --git a/types/canvas-confetti/tslint.json b/types/canvas-confetti/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/canvas-confetti/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/catbox/catbox-tests.ts b/types/catbox/catbox-tests.ts index 565573adad..25d4826d25 100644 --- a/types/catbox/catbox-tests.ts +++ b/types/catbox/catbox-tests.ts @@ -1,26 +1,26 @@ -import Catbox = require("catbox"); +import { CacheItem, Client, Policy, EnginePrototypeOrObject } from "catbox"; -const Memory: Catbox.EnginePrototypeOrObject = { - start(callback: Catbox.CallBackNoResult) {}, - stop() {}, - get() {}, - set() {}, - drop() {}, +const Memory: EnginePrototypeOrObject = { + async start(): Promise {}, + stop(): void {}, + async get(): Promise {}, + async set(): Promise {}, + async drop(): Promise {}, isReady(): boolean { return true; }, validateSegmentName(segment: string): null { return null; }, }; -const client = new Catbox.Client(Memory, { partition: 'cache' }); +const client = new Client(Memory, { partition: 'cache' }); -const cache = new Catbox.Policy({ +const cache = new Policy({ expiresIn: 5000, }, client, 'cache'); -cache.set('foo', 'bar', 5000, () => {}); +cache.set('foo', 'bar', 5000).then(() => {}); -cache.get('foo', () => {}); +cache.get('foo').then(() => {}); -cache.drop('foo', () => {}); +cache.drop('foo').then(() => {}); cache.isReady(); diff --git a/types/catbox/index.d.ts b/types/catbox/index.d.ts index 826f1f7369..6d51e48696 100644 --- a/types/catbox/index.d.ts +++ b/types/catbox/index.d.ts @@ -1,14 +1,11 @@ -// Type definitions for catbox 7.1 +// Type definitions for catbox 10.0 // Project: https://github.com/hapijs/catbox -// Definitions by: Jason Swearingen , AJP +// Definitions by: Jason Swearingen +// AJP +// Rodrigo Saboya // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 -import * as Boom from 'boom'; - -export type CallBackNoResult = (err?: Boom.BoomError) => void; -export type CallBackWithResult = (err: Boom.BoomError | null | undefined, result: T) => void; - /** * Client * The Client object provides a low-level cache abstraction. The object is constructed using new Client(engine, options) where: @@ -23,34 +20,31 @@ export type CallBackWithResult = (err: Boom.BoomError | null | undefined, res export class Client implements ClientApi { constructor(engine: EnginePrototypeOrObject, options: ClientOptions); - /** start(callback) - creates a connection to the cache server. Must be called before any other method is available. The callback signature is function(err). */ - start(callback: CallBackNoResult): void; + /** start() - creates a connection to the cache server. Must be called before any other method is available. */ + start(): Promise; /** stop() - terminates the connection to the cache server. */ stop(): void; /** * get(key, callback) - retrieve an item from the cache engine if found where: * * key - a cache key object (see [ICacheKey]). - * * callback - a function with the signature function(err, cached). If the item is not found, both err and cached are null. If found, the cached object is returned */ - get(key: CacheKey, callback: CallBackWithResult): CacheItem; + get(key: CacheKey): Promise; /** * set(key, value, ttl, callback) - store an item in the cache for a specified length of time, where: * * key - a cache key object (see [ICacheKey]). * * value - the string or object value to be stored. * * ttl - a time-to-live value in milliseconds after which the item is automatically removed from the cache (or is marked invalid). - * * callback - a function with the signature function(err). */ - set(key: CacheKey, value: CacheItem, ttl: number, callback: CallBackNoResult): void; + set(key: CacheKey, value: CacheItem, ttl: number): Promise; /** * drop(key, callback) - remove an item from cache where: * * key - a cache key object (see [ICacheKey]). - * * callback - a function with the signature function(err). */ - drop(key: CacheKey, callback: CallBackNoResult): void; + drop(key: CacheKey): Promise; /** isReady() - returns true if cache engine determines itself as ready, false if it is not ready. */ isReady(): boolean; /** validateSegmentName(segment) - returns null if the segment name is valid (see below), otherwise should return an instance of Error with an appropriate message. */ - validateSegmentName(segment: string): null | Boom.BoomError; + validateSegmentName(segment: string): null | Error; } export type EnginePrototypeOrObject = EnginePrototype | ClientApi; @@ -68,34 +62,31 @@ export interface EnginePrototype { * @see {@link https://github.com/hapijs/catbox#api} */ export interface ClientApi { - /** start(callback) - creates a connection to the cache server. Must be called before any other method is available. The callback signature is function(err). */ - start(callback: CallBackNoResult): void; + /** start() - creates a connection to the cache server. Must be called before any other method is available. */ + start(): Promise; /** stop() - terminates the connection to the cache server. */ stop(): void; /** * get(key, callback) - retrieve an item from the cache engine if found where: * * key - a cache key object (see [ICacheKey]). - * * callback - a function with the signature function(err, cached). If the item is not found, both err and cached are null. If found, the cached object is returned */ - get(key: CacheKey, callback: CallBackWithResult): CacheItem; + get(key: CacheKey): Promise; /** - * set(key, value, ttl, callback) - store an item in the cache for a specified length of time, where: + * set(key, value, ttl) - store an item in the cache for a specified length of time, where: * * key - a cache key object (see [ICacheKey]). * * value - the string or object value to be stored. * * ttl - a time-to-live value in milliseconds after which the item is automatically removed from the cache (or is marked invalid). - * * callback - a function with the signature function(err). */ - set(key: CacheKey, value: CacheItem, ttl: number, callback: CallBackNoResult): void; + set(key: CacheKey, value: CacheItem, ttl: number): Promise; /** - * drop(key, callback) - remove an item from cache where: + * drop(key) - remove an item from cache where: * * key - a cache key object (see [ICacheKey]). - * * callback - a function with the signature function(err). */ - drop(key: CacheKey, callback: CallBackNoResult): void; + drop(key: CacheKey): Promise; /** isReady() - returns true if cache engine determines itself as ready, false if it is not ready. */ isReady(): boolean; /** validateSegmentName(segment) - returns null if the segment name is valid (see below), otherwise should return an instance of Error with an appropriate message. */ - validateSegmentName(segment: string): null | Boom.BoomError; + validateSegmentName(segment: string): null | Error; } /** @@ -135,27 +126,24 @@ export interface ClientOptions { export class Policy implements PolicyAPI { constructor(options: PolicyOptions, cache: Client, segment: string); /** - * get(id, callback) - retrieve an item from the cache. If the item is not found and the generateFunc method was provided, + * get(id) - retrieve an item from the cache. If the item is not found and the generateFunc method was provided, * a new value is generated, stored in the cache, and returned. Multiple concurrent requests are queued and processed once. The method arguments are: * * id - the unique item identifier (within the policy segment). Can be a string or an object with the required 'id' key. - * * callback - the return function. */ - get(id: string | {id: string}, callback: PolicyGetCallback): CacheItem; + get(id: string | { id: string }): Promise; /** - * set(id, value, ttl, callback) - store an item in the cache where: + * set(id, value, ttl) - store an item in the cache where: * * id - the unique item identifier (within the policy segment). * * value - the string or object value to be stored. * * ttl - a time-to-live override value in milliseconds after which the item is automatically removed from the cache (or is marked invalid). * This should be set to 0 in order to use the caching rules configured when creating the Policy object. - * * callback - a function with the signature function(err). */ - set(id: string | {id: string}, value: CacheItem, ttl: number | null, callback: CallBackNoResult): void; + set(id: string | { id: string }, value: CacheItem, ttl: number | null): Promise; /** - * drop(id, callback) - remove the item from cache where: + * drop(id) - remove the item from cache where: * * id - the unique item identifier (within the policy segment). - * * callback - a function with the signature function(err). */ - drop(id: string | {id: string}, callback: CallBackNoResult): void; + drop(id: string | { id: string }): Promise; /** ttl(created) - given a created timestamp in milliseconds, returns the time-to-live left based on the configured rules. */ ttl(created: number): number; /** rules(options) - changes the policy rules after construction (note that items already stored will not be affected) */ @@ -173,27 +161,24 @@ export class Policy implements PolicyAPI { */ export interface PolicyAPI { /** - * get(id, callback) - retrieve an item from the cache. If the item is not found and the generateFunc method was provided, + * get(id) - retrieve an item from the cache. If the item is not found and the generateFunc method was provided, * a new value is generated, stored in the cache, and returned. Multiple concurrent requests are queued and processed once. The method arguments are: * * id - the unique item identifier (within the policy segment). Can be a string or an object with the required 'id' key. - * * callback - the return function. */ - get(id: string | {id: string}, callback: PolicyGetCallback): CacheItem; + get(id: string | { id: string }): Promise; /** - * set(id, value, ttl, callback) - store an item in the cache where: + * set(id, value, ttl) - store an item in the cache where: * * id - the unique item identifier (within the policy segment). * * value - the string or object value to be stored. * * ttl - a time-to-live override value in milliseconds after which the item is automatically removed from the cache (or is marked invalid). * This should be set to 0 in order to use the caching rules configured when creating the Policy object. - * * callback - a function with the signature function(err). */ - set(id: string | {id: string}, value: CacheItem, ttl: number | null, callback: CallBackNoResult): void; + set(id: string | { id: string }, value: CacheItem, ttl: number | null): Promise; /** - * drop(id, callback) - remove the item from cache where: + * drop(id) - remove the item from cache where: * * id - the unique item identifier (within the policy segment). - * * callback - a function with the signature function(err). */ - drop(id: string | {id: string}, callback: CallBackNoResult): void; + drop(id: string | { id: string }): Promise; /** ttl(created) - given a created timestamp in milliseconds, returns the time-to-live left based on the configured rules. */ ttl(created: number): number; /** rules(options) - changes the policy rules after construction (note that items already stored will not be affected) */ @@ -204,16 +189,13 @@ export interface PolicyAPI { stats(): CacheStatisticsObject; } -/** - * The return function. The function signature is function(err, value, cached, report) where: - * @param err - any errors encountered. - * @param value - the fetched or generated value. - * @param cached - null if a valid item was not found in the cache, or IPolicyGetCallbackCachedOptions - * @param report - an object with logging information about the generation operation - */ -export type PolicyGetCallback = (err: null | Boom.BoomError, value: CacheItem, cached: PolicyGetCallbackCachedOptions, report: PolicyGetCallbackReportLog) => void; +export interface PolicyGetPromiseResult { + value: CacheItem; + cached: PolicyGetCachedOptions; + report: PolicyGetReportLog; +} -export interface PolicyGetCallbackCachedOptions { +export interface PolicyGetCachedOptions { /** item - the cached value. */ item: CacheItem; /** stored - the timestamp when the item was stored in the cache. */ @@ -262,10 +244,14 @@ export interface PolicyOptions { pendingGenerateTimeout?: number; } +export interface GenerateFuncFlags { + ttl: number; +} + /** * generateFunc * Is used in PolicyOptions - * A function used to generate a new cache item if one is not found in the cache when calling get(). The method's signature is function(id, next) + * A function used to generate a new cache item if one is not found in the cache when calling get(). The method's signature is function(id) * @param id - the id string or object provided to the get() method. * @param next - the method called when the new item is returned with the signature function(err, value, ttl) where: * * err - an error condition. @@ -273,12 +259,12 @@ export interface PolicyOptions { * * ttl - the cache ttl value in milliseconds. Set to 0 to skip storing in the cache. Defaults to the cache global policy. * @see {@link https://github.com/hapijs/catbox#policy} */ -export type GenerateFunc = (id: string, next: ((err: null | Boom.BoomError, value: CacheItem, ttl?: number) => void)) => void; +export type GenerateFunc = (id: string, flags: GenerateFuncFlags) => Promise; /** * An object with logging information about the generation operation containing the following keys (as relevant): */ -export interface PolicyGetCallbackReportLog { +export interface PolicyGetReportLog { /** msec - the cache lookup time in milliseconds. */ msec: number; /** stored - the timestamp when the item was stored in the cache. */ @@ -288,7 +274,7 @@ export interface PolicyGetCallbackReportLog { /** ttl - the cache ttl value for the record. */ ttl: number; /** error - lookup error. */ - error?: Boom.BoomError; + error?: Error; } /** diff --git a/types/catbox/tsconfig.json b/types/catbox/tsconfig.json index 24e8f7f34e..feb19f81dc 100644 --- a/types/catbox/tsconfig.json +++ b/types/catbox/tsconfig.json @@ -13,11 +13,6 @@ "../" ], "types": [], - "paths": { - "boom": [ - "boom/v4" - ] - }, "noEmit": true, "forceConsistentCasingInFileNames": true }, diff --git a/types/catbox/v7/catbox-tests.ts b/types/catbox/v7/catbox-tests.ts new file mode 100644 index 0000000000..565573adad --- /dev/null +++ b/types/catbox/v7/catbox-tests.ts @@ -0,0 +1,27 @@ +import Catbox = require("catbox"); + +const Memory: Catbox.EnginePrototypeOrObject = { + start(callback: Catbox.CallBackNoResult) {}, + stop() {}, + get() {}, + set() {}, + drop() {}, + isReady(): boolean { return true; }, + validateSegmentName(segment: string): null { return null; }, +}; + +const client = new Catbox.Client(Memory, { partition: 'cache' }); + +const cache = new Catbox.Policy({ + expiresIn: 5000, +}, client, 'cache'); + +cache.set('foo', 'bar', 5000, () => {}); + +cache.get('foo', () => {}); + +cache.drop('foo', () => {}); + +cache.isReady(); + +cache.stats(); diff --git a/types/catbox/v7/index.d.ts b/types/catbox/v7/index.d.ts new file mode 100644 index 0000000000..826f1f7369 --- /dev/null +++ b/types/catbox/v7/index.d.ts @@ -0,0 +1,310 @@ +// Type definitions for catbox 7.1 +// Project: https://github.com/hapijs/catbox +// Definitions by: Jason Swearingen , AJP +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +import * as Boom from 'boom'; + +export type CallBackNoResult = (err?: Boom.BoomError) => void; +export type CallBackWithResult = (err: Boom.BoomError | null | undefined, result: T) => void; + +/** + * Client + * The Client object provides a low-level cache abstraction. The object is constructed using new Client(engine, options) where: + * engine - is an object or a prototype function implementing the cache strategy: + * * function - a prototype function with the signature function(options). catbox will call new func(options). + * * object - a pre instantiated client implementation object. Does not support passing options. + * options - the strategy configuration object. Each strategy defines its own configuration options with the following common options: + * * partition - the partition name used to isolate the cached results across multiple clients. The partition name is used as the MongoDB database name, + * the Riak bucket, or as a key prefix in Redis and Memcached. To share the cache across multiple clients, use the same partition name. + * @see {@link https://github.com/hapijs/catbox#client} + */ +export class Client implements ClientApi { + constructor(engine: EnginePrototypeOrObject, options: ClientOptions); + + /** start(callback) - creates a connection to the cache server. Must be called before any other method is available. The callback signature is function(err). */ + start(callback: CallBackNoResult): void; + /** stop() - terminates the connection to the cache server. */ + stop(): void; + /** + * get(key, callback) - retrieve an item from the cache engine if found where: + * * key - a cache key object (see [ICacheKey]). + * * callback - a function with the signature function(err, cached). If the item is not found, both err and cached are null. If found, the cached object is returned + */ + get(key: CacheKey, callback: CallBackWithResult): CacheItem; + /** + * set(key, value, ttl, callback) - store an item in the cache for a specified length of time, where: + * * key - a cache key object (see [ICacheKey]). + * * value - the string or object value to be stored. + * * ttl - a time-to-live value in milliseconds after which the item is automatically removed from the cache (or is marked invalid). + * * callback - a function with the signature function(err). + */ + set(key: CacheKey, value: CacheItem, ttl: number, callback: CallBackNoResult): void; + /** + * drop(key, callback) - remove an item from cache where: + * * key - a cache key object (see [ICacheKey]). + * * callback - a function with the signature function(err). + */ + drop(key: CacheKey, callback: CallBackNoResult): void; + /** isReady() - returns true if cache engine determines itself as ready, false if it is not ready. */ + isReady(): boolean; + /** validateSegmentName(segment) - returns null if the segment name is valid (see below), otherwise should return an instance of Error with an appropriate message. */ + validateSegmentName(segment: string): null | Boom.BoomError; +} + +export type EnginePrototypeOrObject = EnginePrototype | ClientApi; + +/** + * A prototype CatBox engine function + */ +export interface EnginePrototype { + new(settings: ClientOptions): ClientApi; +} + +/** + * Client API + * The Client object provides the following methods: + * @see {@link https://github.com/hapijs/catbox#api} + */ +export interface ClientApi { + /** start(callback) - creates a connection to the cache server. Must be called before any other method is available. The callback signature is function(err). */ + start(callback: CallBackNoResult): void; + /** stop() - terminates the connection to the cache server. */ + stop(): void; + /** + * get(key, callback) - retrieve an item from the cache engine if found where: + * * key - a cache key object (see [ICacheKey]). + * * callback - a function with the signature function(err, cached). If the item is not found, both err and cached are null. If found, the cached object is returned + */ + get(key: CacheKey, callback: CallBackWithResult): CacheItem; + /** + * set(key, value, ttl, callback) - store an item in the cache for a specified length of time, where: + * * key - a cache key object (see [ICacheKey]). + * * value - the string or object value to be stored. + * * ttl - a time-to-live value in milliseconds after which the item is automatically removed from the cache (or is marked invalid). + * * callback - a function with the signature function(err). + */ + set(key: CacheKey, value: CacheItem, ttl: number, callback: CallBackNoResult): void; + /** + * drop(key, callback) - remove an item from cache where: + * * key - a cache key object (see [ICacheKey]). + * * callback - a function with the signature function(err). + */ + drop(key: CacheKey, callback: CallBackNoResult): void; + /** isReady() - returns true if cache engine determines itself as ready, false if it is not ready. */ + isReady(): boolean; + /** validateSegmentName(segment) - returns null if the segment name is valid (see below), otherwise should return an instance of Error with an appropriate message. */ + validateSegmentName(segment: string): null | Boom.BoomError; +} + +/** + * Any method with a key argument takes an object with the following required properties: + */ +export interface CacheKey { + /** segment - a caching segment name string. Enables using a single cache server for storing different sets of items with overlapping ids. */ + segment: string; + /** id - a unique item identifier string (per segment). Can be an empty string. */ + id: string; +} + +/** Cached object contains the following: */ +export interface CachedObject { + /** item - the value stored in the cache using set(). */ + item: any; + /** stored - the timestamp when the item was stored in the cache (in milliseconds). */ + stored: number; + /** ttl - the remaining time-to-live (not the original value used when storing the object). */ + ttl: number; +} + +export type CacheItem = any; + +export interface ClientOptions { + partition: string; +} + +/** + * The Policy object provides a convenient cache interface by setting a global policy which is automatically applied to every storage action. + * The object is constructed using new Policy(options, [cache, segment]) where: + * * options - an object with the IPolicyOptions structure + * * cache - a Client instance (which has already been started). + * * segment - required when cache is provided. The segment name used to isolate cached items within the cache partition. + * @see {@link https://github.com/hapijs/catbox#policy} + */ +export class Policy implements PolicyAPI { + constructor(options: PolicyOptions, cache: Client, segment: string); + /** + * get(id, callback) - retrieve an item from the cache. If the item is not found and the generateFunc method was provided, + * a new value is generated, stored in the cache, and returned. Multiple concurrent requests are queued and processed once. The method arguments are: + * * id - the unique item identifier (within the policy segment). Can be a string or an object with the required 'id' key. + * * callback - the return function. + */ + get(id: string | {id: string}, callback: PolicyGetCallback): CacheItem; + /** + * set(id, value, ttl, callback) - store an item in the cache where: + * * id - the unique item identifier (within the policy segment). + * * value - the string or object value to be stored. + * * ttl - a time-to-live override value in milliseconds after which the item is automatically removed from the cache (or is marked invalid). + * This should be set to 0 in order to use the caching rules configured when creating the Policy object. + * * callback - a function with the signature function(err). + */ + set(id: string | {id: string}, value: CacheItem, ttl: number | null, callback: CallBackNoResult): void; + /** + * drop(id, callback) - remove the item from cache where: + * * id - the unique item identifier (within the policy segment). + * * callback - a function with the signature function(err). + */ + drop(id: string | {id: string}, callback: CallBackNoResult): void; + /** ttl(created) - given a created timestamp in milliseconds, returns the time-to-live left based on the configured rules. */ + ttl(created: number): number; + /** rules(options) - changes the policy rules after construction (note that items already stored will not be affected) */ + rules(options: PolicyOptions): void; + /** isReady() - returns true if cache engine determines itself as ready, false if it is not ready or if there is no cache engine set. */ + isReady(): boolean; + /** stats - an object with cache statistics */ + stats(): CacheStatisticsObject; +} + +/** + * Policy API + * The Policy object provides the following methods: + * @see {@link https://github.com/hapijs/catbox#api-1} + */ +export interface PolicyAPI { + /** + * get(id, callback) - retrieve an item from the cache. If the item is not found and the generateFunc method was provided, + * a new value is generated, stored in the cache, and returned. Multiple concurrent requests are queued and processed once. The method arguments are: + * * id - the unique item identifier (within the policy segment). Can be a string or an object with the required 'id' key. + * * callback - the return function. + */ + get(id: string | {id: string}, callback: PolicyGetCallback): CacheItem; + /** + * set(id, value, ttl, callback) - store an item in the cache where: + * * id - the unique item identifier (within the policy segment). + * * value - the string or object value to be stored. + * * ttl - a time-to-live override value in milliseconds after which the item is automatically removed from the cache (or is marked invalid). + * This should be set to 0 in order to use the caching rules configured when creating the Policy object. + * * callback - a function with the signature function(err). + */ + set(id: string | {id: string}, value: CacheItem, ttl: number | null, callback: CallBackNoResult): void; + /** + * drop(id, callback) - remove the item from cache where: + * * id - the unique item identifier (within the policy segment). + * * callback - a function with the signature function(err). + */ + drop(id: string | {id: string}, callback: CallBackNoResult): void; + /** ttl(created) - given a created timestamp in milliseconds, returns the time-to-live left based on the configured rules. */ + ttl(created: number): number; + /** rules(options) - changes the policy rules after construction (note that items already stored will not be affected) */ + rules(options: PolicyOptions): void; + /** isReady() - returns true if cache engine determines itself as ready, false if it is not ready or if there is no cache engine set. */ + isReady(): boolean; + /** stats - an object with cache statistics */ + stats(): CacheStatisticsObject; +} + +/** + * The return function. The function signature is function(err, value, cached, report) where: + * @param err - any errors encountered. + * @param value - the fetched or generated value. + * @param cached - null if a valid item was not found in the cache, or IPolicyGetCallbackCachedOptions + * @param report - an object with logging information about the generation operation + */ +export type PolicyGetCallback = (err: null | Boom.BoomError, value: CacheItem, cached: PolicyGetCallbackCachedOptions, report: PolicyGetCallbackReportLog) => void; + +export interface PolicyGetCallbackCachedOptions { + /** item - the cached value. */ + item: CacheItem; + /** stored - the timestamp when the item was stored in the cache. */ + stored: number; + /** ttl - the cache ttl value for the record. */ + ttl: number; + /** isStale - true if the item is stale. */ + isStale: boolean; +} + +/** + * @see {@link https://github.com/hapijs/catbox#policy} + */ +export interface PolicyOptions { + /** expiresIn - relative expiration expressed in the number of milliseconds since the item was saved in the cache. Cannot be used together with expiresAt. */ + expiresIn?: number; + /** expiresAt - time of day expressed in 24h notation using the 'HH:MM' format, at which point all cache records for the route expire. Uses local time. Cannot be used together with expiresIn. */ + expiresAt?: string; + /** generateFunc - a function used to generate a new cache item if one is not found in the cache when calling get(). The method's signature is function(id, next) where: */ + generateFunc?: GenerateFunc; + /** + * staleIn - number of milliseconds to mark an item stored in cache as stale and attempt to regenerate it when generateFunc is provided. + * Must be less than expiresIn. Alternatively function that returns staleIn value in milliseconds. The function signature is function(stored, ttl) where: + * * stored - the timestamp when the item was stored in the cache (in milliseconds). + * * ttl - the remaining time-to-live (not the original value used when storing the object). + */ + staleIn?: number | ((stored: number, ttl: number) => number); + /** staleTimeout - number of milliseconds to wait before returning a stale value while generateFunc is generating a fresh value. */ + staleTimeout?: number; + /** + * generateTimeout - number of milliseconds to wait before returning a timeout error when the generateFunc function takes too long to return a value. + * When the value is eventually returned, it is stored in the cache for future requests. Required if generateFunc is present. + * Set to false to disable timeouts which may cause all get() requests to get stuck forever. + */ + generateTimeout?: number | false; + /** dropOnError - if true, an error or timeout in the generateFunc causes the stale value to be evicted from the cache. Defaults to true. */ + dropOnError?: boolean; + /** generateOnReadError - if false, an upstream cache read error will stop the get() method from calling the generate function and will instead pass back the cache error. Defaults to true. */ + generateOnReadError?: boolean; + /** generateIgnoreWriteError - if false, an upstream cache write error will be passed back with the generated value when calling the get() method. Defaults to true. */ + generateIgnoreWriteError?: boolean; + /** + * pendingGenerateTimeout - number of milliseconds while generateFunc call is in progress for a given id, before a subsequent generateFunc call is allowed. + * Defaults to 0, no blocking of concurrent generateFunc calls beyond staleTimeout. + */ + pendingGenerateTimeout?: number; +} + +/** + * generateFunc + * Is used in PolicyOptions + * A function used to generate a new cache item if one is not found in the cache when calling get(). The method's signature is function(id, next) + * @param id - the id string or object provided to the get() method. + * @param next - the method called when the new item is returned with the signature function(err, value, ttl) where: + * * err - an error condition. + * * value - the new value generated. + * * ttl - the cache ttl value in milliseconds. Set to 0 to skip storing in the cache. Defaults to the cache global policy. + * @see {@link https://github.com/hapijs/catbox#policy} + */ +export type GenerateFunc = (id: string, next: ((err: null | Boom.BoomError, value: CacheItem, ttl?: number) => void)) => void; + +/** + * An object with logging information about the generation operation containing the following keys (as relevant): + */ +export interface PolicyGetCallbackReportLog { + /** msec - the cache lookup time in milliseconds. */ + msec: number; + /** stored - the timestamp when the item was stored in the cache. */ + stored: number; + /** isStale - true if the item is stale. */ + isStale: boolean; + /** ttl - the cache ttl value for the record. */ + ttl: number; + /** error - lookup error. */ + error?: Boom.BoomError; +} + +/** + * an object with cache statistics where: + */ +export interface CacheStatisticsObject { + /** sets - number of cache writes. */ + sets: number; + /** gets - number of cache get() requests. */ + gets: number; + /** hits - number of cache get() requests in which the requested id was found in the cache (can be stale). */ + hits: number; + /** stales - number of cache reads with stale requests (only counts the first request in a queued get() operation). */ + stales: number; + /** generates - number of calls to the generate function. */ + generates: number; + /** errors - cache operations errors. TODO check this */ + errors: number; +} diff --git a/types/catbox/v7/tsconfig.json b/types/catbox/v7/tsconfig.json new file mode 100644 index 0000000000..48b4d9f014 --- /dev/null +++ b/types/catbox/v7/tsconfig.json @@ -0,0 +1,31 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "paths": { + "boom": [ + "boom/v4" + ], + "catbox": [ + "catbox/v7" + ] + }, + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "catbox-tests.ts" + ] +} \ No newline at end of file diff --git a/types/catbox/v7/tslint.json b/types/catbox/v7/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/catbox/v7/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/chokidar/index.d.ts b/types/chokidar/index.d.ts index 396ad10e0a..6acc9af265 100644 --- a/types/chokidar/index.d.ts +++ b/types/chokidar/index.d.ts @@ -149,7 +149,7 @@ export interface WatchOptions { /** * can be set to an object in order to adjust timing params: */ - awaitWriteFinish?: AwaitWriteFinishOptions; + awaitWriteFinish?: AwaitWriteFinishOptions | boolean; } export interface AwaitWriteFinishOptions { diff --git a/types/cytoscape/index.d.ts b/types/cytoscape/index.d.ts index ad0c8de371..b04ac2276e 100644 --- a/types/cytoscape/index.d.ts +++ b/types/cytoscape/index.d.ts @@ -427,7 +427,7 @@ declare namespace cytoscape { /** * Get elements in the graph matching the specified selector or filter function. */ - filter(selector: Selector | ((i: number, ele: Singular) => boolean)): CollectionElements; + filter(selector: Selector | ((ele: Singular, i: number, eles: CollectionElements) => boolean)): CollectionElements; /** * Allow for manipulation of elements without triggering multiple style calculations or multiple redraws. @@ -2231,7 +2231,7 @@ declare namespace cytoscape { * ele - The element being considered. * http://js.cytoscape.org/#eles.filter */ - filter(selector: Selector | ((i: number, ele: CollectionElements) => boolean)): CollectionElements; + filter(selector: Selector | ((ele: Singular, i: number, eles: CollectionElements) => boolean)): CollectionElements; /** * Get the nodes that match the specified selector. * diff --git a/types/d3-collection/d3-collection-tests.ts b/types/d3-collection/d3-collection-tests.ts index 91a72479db..b2e6c2f68b 100644 --- a/types/d3-collection/d3-collection-tests.ts +++ b/types/d3-collection/d3-collection-tests.ts @@ -38,6 +38,7 @@ let booleanFlag: boolean; // test keys(...) signatures ------------------------------------------------------ stringArray = d3Collection.keys(keyValueObj); +stringArray = d3Collection.keys([0, 1, 2]); stringArray = d3Collection.keys(document); // purely for the fun of it @@ -48,17 +49,21 @@ anyArray = d3Collection.values(keyValueObj); stringArray = d3Collection.values(keyValueObj2); stringArray = d3Collection.values(keyValueObj2); +// stringArray = d3Collection.values(keyValueObj); // test fails, as values in keyValueObj do not meet generic constraint +stringArray = d3Collection.values(['1', '2']); anyArray = d3Collection.values(document); // purely for the fun of it // test entries(...) signatures ------------------------------------------------------ anyKVArray = d3Collection.entries(keyValueObj); -// stringKVArray = d3Collection.entres(keyValueObj); // test fails, as values in keyValueObj are not all strings +// stringKVArray = d3Collection.entries(keyValueObj); // test fails, as values in keyValueObj are not all strings stringKVArray = d3Collection.entries(keyValueObj2); stringKVArray = d3Collection.entries(keyValueObj2); +// stringKVArray = d3Collection.entries(keyValueObj); // test fails, as values in keyValueObj do not meet generic constraint +stringKVArray = d3Collection.entries(['1', '2']); anyKVArray = d3Collection.entries(document); // purely for the fun of it // --------------------------------------------------------------------- @@ -70,13 +75,15 @@ interface TestObject { val: number; } -let testObject: TestObject; +let testObjectMaybe: TestObject | undefined; let testObjArray: TestObject[]; let testObjKVArray: Array<{ key: string, value: TestObject }>; // Create Map ======================================================== let basicMap: d3Collection.Map; +let anyMap: d3Collection.Map; +anyMap = d3Collection.map(); // empty map basicMap = d3Collection.map(); // empty map // from array with accessor without accessor @@ -107,7 +114,7 @@ booleanFlag = basicMap.has('foo'); // get(...) ------------------------------------------------------------ -testObject = testObjMap.get('foo'); +testObjectMaybe = testObjMap.get('foo'); // set(...) ------------------------------------------------------------ @@ -304,11 +311,11 @@ let testL1NestedMapRollup: TestL1NestedMapRollup; testL2NestedMap = nestL2.map(raw); -num = testL2NestedMap.get('1931').get('Manchuria')[0].yield; // access chain to leaf property +num = testL2NestedMap.get('1931')!.get('Manchuria')![0].yield; // use existence assertion with care for access chain to leaf property testL1NestedMapRollup = nestL1Rollup.map(raw); -num = testL1NestedMapRollup.get('1931'); // get rollup value +num = testL1NestedMapRollup.get('1931')!; // get rollup value (use existence assertion with care) // object(...) -------------------------------------------------------- @@ -345,7 +352,7 @@ type TestL2NestedArray = Array<{ type TestL1NestedArrayRollup = Array<{ key: string; - value: number; + value?: number; // conservatively allow for value to be undefined }>; let testL2NestedArray: TestL2NestedArray; @@ -357,4 +364,4 @@ num = testL2NestedArray[0].values[0].values[0].yield; // access chain to leaf pr testL1NestedArrayRollup = nestL1Rollup.entries(raw); -num = testL1NestedArrayRollup[0].value; // get rollup value +num = testL1NestedArrayRollup[0].value!; // get rollup value use existence assertion with care diff --git a/types/d3-collection/index.d.ts b/types/d3-collection/index.d.ts index e389862394..5e7973e03b 100644 --- a/types/d3-collection/index.d.ts +++ b/types/d3-collection/index.d.ts @@ -2,8 +2,9 @@ // Project: https://github.com/d3/d3-collection/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 -// Last module patch version validated against: 1.0.1 +// Last module patch version validated against: 1.0.4 /** * Reference type things that can be coerced to string implicitely @@ -16,106 +17,467 @@ export interface Stringifiable { // Objects // --------------------------------------------------------------------- -export function keys(object: { [key: string]: any }): string[]; -// TODO: When upgrading definitions to use TS 2.2+, use "object" data type in next line -export function keys(object: any): string[]; +/** + * Returns an array containing the property names of the specified object (an associative array). + * The order of the returned array is undefined. + * + * @param obj An object. + */ +export function keys(obj: object): string[]; -export function values(object: { [key: string]: T }): T[]; -// TODO: When upgrading definitions to use TS 2.2+, use "object" data type in next line -export function values(object: any): any[]; +/** + * Returns an array containing the property values of the specified object (an associative array). + * The order of the returned array is undefined. + * + * The generic refers to the data type of the values. + * + * @param obj An object. + */ +export function values(obj: { [key: string]: T } | ArrayLike): T[]; +/** + * Returns an array containing the property values of the specified object (an associative array). + * The order of the returned array is undefined. + * + * @param obj An object. + */ +export function values(obj: object): any[]; -export function entries(object: { [key: string]: T }): Array<{ key: string, value: T }>; -// TODO: When upgrading definitions to use TS 2.2+, use "object" data type in next line -export function entries(object: any): Array<{ key: string, value: any }>; +/** + * Returns an array containing the property keys and values of the specified object (an associative array). + * Each entry is an object with a key and value attribute.The order of the returned array is undefined. + * + * The generic refers to the data type of the values. + * + * @param obj An object. + */ +export function entries(obj: { [key: string]: T } | ArrayLike): Array<{ key: string, value: T }>; +/** + * Returns an array containing the property keys and values of the specified object (an associative array). + * Each entry is an object with a key and value attribute.The order of the returned array is undefined. + * + * @param obj An object. + */ +export function entries(obj: object): Array<{ key: string, value: any }>; // --------------------------------------------------------------------- // map / Map // --------------------------------------------------------------------- +/** + * A datastructure similar to ES6 Maps, but with a few differences: + * - Keys are coerced to strings. + * - map.each, not map.forEach. (Also, no thisArg.) + * - map.remove, not map.delete. + * - map.entries returns an array of {key, value} objects, not an iterator of [key, value]. + * - map.size is a method, not a property; also, there’s map.empty. + * + * The generic refers to the data type of the map entry values. + */ export interface Map { + /** + * Returns true if and only if this map has an entry for the specified key string. + * Note: the value may be null or undefined. + * + * @param key Key of map entry to access. + */ has(key: string): boolean; + /** + * Returns the value for the specified key string. + * If the map does not have an entry for the specified key, returns undefined. + * + * @param key Key of map entry to access. + */ get(key: string): T | undefined; + /** + * Sets the value for the specified key string and returns the updated map. + * If the map previously had an entry for the same key string, the old entry is replaced with the new value. + * + * @param key Key of map entry to access. + * @param value Value to set for entry at key. + */ set(key: string, value: T): this; + /** + * If the map has an entry for the specified key string, removes the entry and returns true. + * Otherwise, this method does nothing and returns false. + * + * @param key Map key for which to remove the entry. + */ remove(key: string): boolean; + /** + * Removes all entries from this map. + */ clear(): void; + /** + * Returns an array of string keys for every entry in this map. + * The order of the returned keys is arbitrary. + */ keys(): string[]; + /** + * Returns an array of values for every entry in this map. + * The order of the returned values is arbitrary. + */ values(): T[]; + /** + * Returns an array of key-value objects for each entry in this map. The order of the returned entries is arbitrary. + * Each entry’s key is a string, but the value can have arbitrary type. + */ entries(): Array<{ key: string, value: T }>; + /** + * Calls the specified function for each entry in this map and returns undefined. + * The iteration order is arbitrary. + * + * @param func Function to call for each entry. The function is passed the entry’s value and key as arguments, + * followed by the map itself. + */ each(func: (value: T, key: string, map: Map) => void): void; + /** + * Returns true if and only if this map has zero entries. + */ empty(): boolean; + /** + * Returns the number of entries in this map. + */ size(): number; } -export function map(): Map; +/** + * Constructs a new empty map. + * + * The generic refers to the data type of the map entry values. + */ +export function map(): Map; +/** + * Constructs a new map by copying another map. + * + * The generic refers to the data type of the map entry values. + * + * @param d3Map A D3 Map. + */ export function map(d3Map: Map): Map; -export function map(object: { [key: string]: T }): Map; -export function map(object: { [key: number]: T }): Map; +/** + * Constructs a new map by copying all enumerable properties from the specified object into this map. + * + * The generic refers to the data type of the map entry values. + * + * @param obj Object to construct the map from. + */ +export function map(obj: { [key: string]: T }): Map; +/** + * Constructs a new map by copying all enumerable properties from the specified object into this map. + * + * The generic refers to the data type of the map entry values. + * + * @param obj Object to construct the map from. + */ +export function map(obj: { [key: number]: T }): Map; +/** + * Constructs a new map from the elements of an array. + * An optional key function may be specified to compute the key for each value in the array. + * + * The generic refers to the data type of the map entry values. + * + * @param array Array to convert into a map + * @param key An optional key function. The functions is invoked for each element in the array being passed + * the element's value , it's zero-based index in the array, and the array itself. The function must return a unique string + * to be used as the map entry's key. + */ export function map(array: T[], key?: (value: T, i?: number, array?: T[]) => string): Map; -export function map(object: any): Map; // TODO: When upgrading definitions to use TS 2.2+, use "object" data type for argument +/** + * Constructs a new map by copying all enumerable properties from the specified object into this map. + * + * @param obj Object to construct the map from. + */ +export function map(obj: object): Map; // --------------------------------------------------------------------- // set / Set // --------------------------------------------------------------------- +/** + * A datastructure similar to ES6 Sets, but with a few differences: + * + * - Values are coerced to strings. + * - set.each, not set.forEach. (Also, no thisArg.) + * - set.remove, not set.delete. + * - set.size is a method, not a property; also, there’s set.empty. + */ export interface Set { + /** + * Returns true if and only if this set has an entry for the specified value string. + * + * @param value Value whose membership in the class to test. + */ has(value: string | Stringifiable): boolean; + /** + * Adds the specified value string to this set and returns the set. + * + * @param value Value to add to set. + */ add(value: string | Stringifiable): this; + /** + * If the set contains the specified value string, removes it and returns true. + * Otherwise, this method does nothing and returns false. + * + * @param value Value to remove from set. + */ remove(value: string | Stringifiable): boolean; + /** + * Removes all values from this set. + */ clear(): void; + /** + * Returns an array of the string values in this set. The order of the returned values is arbitrary. + * Can be used as a convenient way of computing the unique values for a set of strings. + */ values(): string[]; /** - * The first and second parameter of the function are both passed - * the 'value' of the set entry for consistency with map.each(...) - * signature + * Calls the specified function for each value in this set, passing the value as the first two arguments (for symmetry with map.each), + * followed by the set itself. Returns undefined. + * The iteration order is arbitrary. + * + * @param func Function to call for each set element. The first and second argument of the function are both passed + * the 'value' of the set entry for consistency with the map.each(...) signature, as a third argument the entire set is passed in. */ each(func: (value: string, valueRepeat: string, set: Set) => void): void; + /** + * Returns true if and only if this set has zero values. + */ empty(): boolean; + /** + * Returns the number of values in this set. + */ size(): number; } +/** + * Constructs a new empty set. + */ export function set(): Set; +/** + * Constructs a new set by copying an existing set. + * + * @param set A D3 set. + */ export function set(d3Set: Set): Set; +/** + * Constructs a new set by adding the given array of string values to the returned set. + * + * @param array An array of strings of values which can be implicitly converted to strings. + */ export function set(array: Array): Set; -export function set(array: T[], key: (value: T, index?: number, array?: T[]) => string): Set; +/** + * Constructs a new set from an array, adds an array of mapped string values to the returned set. + * The specified accessor function is invoked equivalent to calling array.map(accessor) before constructing the set. + * + * The generic refers to the data type of the array elements. + * + * @param array An Array of values to map and add as set elements. + * @param key An accessor function used to map the original array elements to string elements to be added to the set. + * The function is invoked for each array element, being passed the element's value, it's zero-based index in the array, and the array itself. + */ +export function set(array: T[], key: (value: T, index: number, array: T[]) => string): Set; // --------------------------------------------------------------------- // nest / Nest // --------------------------------------------------------------------- -// NB: the following three interfaces NestedArray, NestedMap and NestedObject provide a more formal definitions -// of the return values provided by Nest.entries(...), Nest.map(...) and Nest.object(...), respectively. However, -// the union types cannot be ex ante simplified without knowledge of the nesting level (number of key(...) operations) -// and whether the data were rolled-up. The latter question also determins whether NestedArray has the 'values' property -// with an array of type Datum at leaf level, or has a rolled-up 'value' property. -// The interfaces are not used as return types, as they are cumbersome to work with on the consuming side (Determining the -// applicable type from the respective union, i. p. for array elements). -// It is preferable to carefully define appropriate use-case-specific interfaces for the variables that -// are assigned the return values of the Nest.entries(...), Nest.map(...) and Nest.object(...) operations. The downside -// is an overly permissive return type. - -// Also note, that the below return types for Nest.entries(...), Nest.map(...) and Nest.object(...) strictly only work, -// if AT LEAST ONE KEY was set. This seems a reasonable constraint in practice, given the intent of the nest operator. -// Otherwise, an additional '| Datum[] | RollupType` would have to be added to the union type. This would cover -// cases (a) without key or rollup (b) without key but with rollup. However, again, the union types make it cumbersome -// without much gain. - +/** + * A more formal defintion of the nested array returned by Nest.entries(...). This data structure is intended as a reference only. + * + * As the union types cannot be ex ante simplified without knowledge + * of the nesting level (number of key(...) operations) and whether the data were rolled-up, this data structure becomes cumbersome + * to use in practice. This is particularly true for discrimiation of array element types. + * The use of the rollup function, or lack thereof, also determines whether NestedArray has the 'values' property + * with an array of type Datum at leaf level, or has a rolled-up 'value' property. + */ // tslint:disable-next-line:no-empty-interface export interface NestedArray extends Array<{ key: string, values: NestedArray | Datum[] | undefined, value: RollupType | undefined }> { } + +/** + * A more formal defintion of the nested array returned by Nest.map(...). This data structure is intended as a reference only. + * + * As the union types cannot be ex ante simplified without knowledge + * of the nesting level (number of key(...) operations) and whether the data were rolled-up, this data structure becomes cumbersome + * to use in practice. + */ // tslint:disable-next-line:no-empty-interface export interface NestedMap extends Map | Datum[] | RollupType> { } + +/** + * A more formal defintion of the nested array returned by Nest.object(...). This data structure is intended as a reference only. + * + * As the union types cannot be ex ante simplified without knowledge + * of the nesting level (number of key(...) operations) and whether the data were rolled-up, this data structure becomes cumbersome + * to use in practice. + */ export interface NestedObject { [key: string]: NestedObject | Datum[] | RollupType; } +/** + * A nest operator for generating nested data structures from arrays. + * + * Nesting allows elements in an array to be grouped into a hierarchical tree structure; + * think of it like the GROUP BY operator in SQL, except you can have multiple levels of grouping, and the resulting output is a tree rather than a flat table. + * The levels in the tree are specified by key functions. The leaf nodes of the tree can be sorted by value, while the internal nodes can be sorted by key. + * An optional rollup function will collapse the elements in each leaf node using a summary function. + * The nest operator is reusable, and does not retain any references to the data that is nested. + * + * The first generic refers to the data type of the array elements on which the nest operator will + * be invoked. + * + * The second generic refers to the data type returned by the roll-up function to be used with the + * nest operator. + */ export interface Nest { + /** + * Registers a new key function and returns this nest operator. + * The key function will be invoked for each element in the input array and must return a string identifier to assign the element to its group. + * Most often, the function is a simple accessor. (Keys functions are not passed the input array index.) + * + * Each time a key is registered, it is pushed onto the end of the internal array of keys, + * and the nest operator applies an additional level of nesting. + * + * @param func A key accessor function being invoked for each element. + */ key(func: (datum: Datum) => string): this; + /** + * Sorts key values for the current key using the specified comparator function, such as d3.ascending or d3.descending. + * + * If no comparator is specified for the current key, the order in which keys will be returned is undefined. + * + * Note that this only affects the result of nest.entries; + * the order of keys returned by nest.map and nest.object is always undefined, regardless of comparator. + * + * @param comparator A comparator function which returns a negative value if, according to the sorting criterion, + * a is less than b, or a positive value if a is greater than b, or 0 if the two values are the same under the sorting criterion. + */ sortKeys(comparator: (a: string, b: string) => number): this; + /** + * Sorts leaf elements using the specified comparator function, such as d3.ascending or d3.descending. + * This is roughly equivalent to sorting the input array before applying the nest operator; + * however it is typically more efficient as the size of each group is smaller. + * + * If no value comparator is specified, elements will be returned in the order they appeared in the input array. + * This applies to nest.map, nest.entries and nest.object. + * + * @param comparator A comparator function which returns a negative value if, according to the sorting criterion, + * a is less than b, or a positive value if a is greater than b, or 0 if the two values are the same under the sorting criterion. + */ sortValues(comparator: (a: Datum, b: Datum) => number): this; + /** + * Specifies a rollup function to be applied on each group of leaf elements and returns this nest operator. + * The return value of the rollup function will replace the array of leaf values in either the associative array returned by nest.map or nest.object; + * for nest.entries, it replaces the leaf entry.values with entry.value. + * + * If a leaf comparator is specified, the leaf elements are sorted prior to invoking the rollup function. + * + * @param func A function computing the rollup value for a group of leaf elements. + */ rollup(func: (values: Datum[]) => RollupType): this; - map(array: Datum[]): Map; // more specifically it returns NestedMap - object(array: Datum[]): { [key: string]: any }; // more specifically it returns NestedObject - entries(array: Datum[]): Array<{ key: string; values: any; value: RollupType | undefined }>; // more specifically it returns NestedArray + /** + * Applies the nest operator to the specified array, returning a nested map. + * + * Each entry in the returned map corresponds to a distinct key value returned by the first key function. + * The entry value depends on the number of registered key functions: if there is an additional key, the value is another map; + * otherwise, the value is the array of elements filtered from the input array that have the given key value. + * + * NOTE: + * + * Strictly speaking the return type of this method is: + * + * (1) NestedMap, if at least one key function was defined, + * + * (2) Datum[], if neither a key nor a rollup function were defined, and + * + * (3) RollupType, if no keys, but a rollup function were defined. + * + * Since (2) and (3) are edge cases with little to no practical relevance, they have been omitted in favour of ease-of-use. + * + * Should you determine that this simplification creates an issue in practice, please file an issue on + * https://github.com/DefinitelyTyped/DefinitelyTyped. + * + * The formal, generalized return type under (1) is cumbersome to work with in practice. The recommended approach + * is to define the type of the variable being assigned the return value using knowledge specific to the use-case at hand. + * I.e. making use of knowing how many keys are applied, and the nature of any roll-up function will make working with + * the variable more meaningful, despite the compromise in type-safety. + * + * @param array An array to create a nested data structure from. + */ + map(array: Datum[]): Map; + /** + * Applies the nest operator to the specified array, returning a nested object. + * Each entry in the returned associative array corresponds to a distinct key value returned by the first key function. + * The entry value depends on the number of registered key functions: if there is an additional key, the value is another associative array; + * otherwise, the value is the array of elements filtered from the input array that have the given key value. + * + * WARNING: this method is unsafe if any of the keys conflict with built-in JavaScript properties, such as __proto__. + * If you cannot guarantee that the keys will be safe, you should use nest.map instead. + * + * NOTE: + * + * Strictly speaking the return type of this method is: + * + * (1) NestedObject, if at least one key function was defined, + * + * (2) Datum[], if neither a key nor a rollup function were defined, and + * + * (3) RollupType, if no keys, but a rollup function were defined. + * + * Since (2) and (3) are edge cases with little to no practical relevance, they have been omitted in favour of ease-of-use. + * + * Should you determine that this simplification creates an issue in practice, please file an issue on + * https://github.com/DefinitelyTyped/DefinitelyTyped. + * + * The formal, generalized return type under (1) is cumbersome to work with in practice. The recommended approach + * is to define the type of the variable being assigned the return value using knowledge specific to the use-case at hand. + * I.e. making use of knowing how many keys are applied, and the nature of any roll-up function will make working with + * the variable more meaningful, despite the compromise in type-safety. + * + * @param array An array to create a nested data structure from. + */ + object(array: Datum[]): { [key: string]: any }; + /** + * Applies the nest operator to the specified array, returning an array of key-values entries. + * Conceptually, this is similar to applying map.entries to the associative array returned by nest.map, + * but it applies to every level of the hierarchy rather than just the first (outermost) level. + * Each entry in the returned array corresponds to a distinct key value returned by the first key function. + * The entry value depends on the number of registered key functions: if there is an additional key, the value is another nested array of entries; + * otherwise, the value is the array of elements filtered from the input array that have the given key value. + * + * NOTE: + * + * Strictly speaking the return type of this method is: + * + * (1) NestedArray, if at least one key function was defined, + * + * (2) Datum[], if neither a key nor a rollup function were defined, and + * + * (3) RollupType, if no keys, but a rollup function were defined. + * + * Since (2) and (3) are edge cases with little to no practical relevance, they have been omitted in favour of ease-of-use. + * + * Should you determine that this simplification creates an issue in practice, please file an issue on + * https://github.com/DefinitelyTyped/DefinitelyTyped. + * + * The formal, generalized return type under (1) is cumbersome to work with in practice. The recommended approach + * is to define the type of the variable being assigned the return value using knowledge specific to the use-case at hand. + * I.e. making use of knowing how many keys are applied, and the nature of any roll-up function will make working with + * the variable more meaningful, despite the compromise in type-safety. + * + * @param array An array to create a nested data structure from. + */ + entries(array: Datum[]): Array<{ key: string; values: any; value: RollupType | undefined }>; } -export function nest(): Nest; -export function nest(): Nest; +/** + * Creates a new nest operator. + * + * The first generic refers to the data type of the array elements on which the nest operator will + * be invoked. + * + * The second generic refers to the data type returned by the roll-up function to be used with the + * nest operator. If not explicitly set, this generic parameter defaults to undefined, implying that + * no rollup function will be applied. + */ +export function nest(): Nest; diff --git a/types/d3-collection/tsconfig.json b/types/d3-collection/tsconfig.json index c2ae30cdbd..7d3824f371 100644 --- a/types/d3-collection/tsconfig.json +++ b/types/d3-collection/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ @@ -21,4 +21,4 @@ "index.d.ts", "d3-collection-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/decompress-response/decompress-response-tests.ts b/types/decompress-response/decompress-response-tests.ts new file mode 100644 index 0000000000..f47665cbe0 --- /dev/null +++ b/types/decompress-response/decompress-response-tests.ts @@ -0,0 +1,6 @@ +import decompressResponse = require("decompress-response"); +import http = require("http"); + +http.get("localhost", response => { + response = decompressResponse(response); +}); diff --git a/types/decompress-response/index.d.ts b/types/decompress-response/index.d.ts new file mode 100644 index 0000000000..8e7ec88646 --- /dev/null +++ b/types/decompress-response/index.d.ts @@ -0,0 +1,11 @@ +// Type definitions for decompress-response 3.3 +// Project: https://github.com/sindresorhus/decompress-response#readme +// Definitions by: Daniel Rosenwasser +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import http = require("http"); + +export = decompress_response; +declare function decompress_response(response: http.IncomingMessage): http.IncomingMessage; diff --git a/types/decompress-response/tsconfig.json b/types/decompress-response/tsconfig.json new file mode 100644 index 0000000000..c7a77a9fd1 --- /dev/null +++ b/types/decompress-response/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", + "decompress-response-tests.ts" + ] +} diff --git a/types/decompress-response/tslint.json b/types/decompress-response/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/decompress-response/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/ember-data/index.d.ts b/types/ember-data/index.d.ts index 0737d1d2a7..7b78770489 100644 --- a/types/ember-data/index.d.ts +++ b/types/ember-data/index.d.ts @@ -491,7 +491,7 @@ declare module 'ember-data' { /** * Same as `deleteRecord`, but saves the record immediately. */ - destroyRecord(options: {}): RSVP.Promise; + destroyRecord(options?: {}): RSVP.Promise; /** * Unloads the record from the store. This will cause the record to be destroyed and freed up for garbage collection. */ @@ -870,7 +870,7 @@ declare module 'ember-data' { */ interface PromiseArray extends Ember.ArrayProxy, - Ember.PromiseProxyMixin> {} + Ember.PromiseProxyMixin> {} class PromiseArray {} /** * A `PromiseObject` is an object that acts like both an `Ember.Object` @@ -881,7 +881,7 @@ declare module 'ember-data' { */ interface PromiseObject extends Ember.ObjectProxy, - Ember.PromiseProxyMixin> {} + Ember.PromiseProxyMixin {} class PromiseObject {} /** * A PromiseManyArray is a PromiseArray that also proxies certain method calls diff --git a/types/ember-data/test/store.ts b/types/ember-data/test/store.ts index 0a9a615d27..f512afd8a7 100644 --- a/types/ember-data/test/store.ts +++ b/types/ember-data/test/store.ts @@ -4,13 +4,16 @@ import { assertType } from './lib/assert'; declare const store: DS.Store; +class PostComment extends DS.Model {} class Post extends DS.Model { title = DS.attr('string'); + comments = DS.hasMany('comment'); } declare module 'ember-data' { interface ModelRegistry { - post: Post; + 'post': Post; + 'post-comment': PostComment; } } @@ -48,7 +51,7 @@ store.queryRecord('user', {}).then(function(user) { console.log(`Currently logged in as ${username}`); }); -store.findAll('post'); // => GET /blog-posts +store.findAll('post'); // => GET /posts store.findAll('author', { reload: true }).then(function(authors) { authors.getEach('id'); // ['first', 'second'] }); @@ -107,6 +110,34 @@ const SomeComponent = Ember.Component.extend({ } }); +const MyRouteAsync = Ember.Route.extend({ + async beforeModel(): Promise> { + const store = Ember.get(this, 'store'); + return await store.findAll('post-comment'); + }, + async model(): Promise { + const store = this.get('store'); + return await store.findRecord('post-comment', 1); + }, + async afterModel(): Promise> { + const post = await this.get('store').findRecord('post', 1); + return await post.get('comments'); + } +}); + +class MyRouteAsyncES6 extends Ember.Route { + async beforeModel(): Promise> { + return await this.store.findAll('post-comment'); + } + async model(): Promise { + return await this.store.findRecord('post-comment', 1); + } + async afterModel(): Promise> { + const post = await this.store.findRecord('post', 1); + return await post.get('comments'); + } +} + // GET to /users?filter[email]=tomster@example.com const tom = store .query('user', { diff --git a/types/ember-data/tsconfig.json b/types/ember-data/tsconfig.json index fca7906347..399268d6b2 100644 --- a/types/ember-data/tsconfig.json +++ b/types/ember-data/tsconfig.json @@ -15,7 +15,8 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true }, "files": [ "index.d.ts", diff --git a/types/ember-data/tslint.json b/types/ember-data/tslint.json index 2389d09a3b..70eef4d46e 100644 --- a/types/ember-data/tslint.json +++ b/types/ember-data/tslint.json @@ -14,6 +14,7 @@ "prefer-const": false, "no-unnecessary-generics": false, "no-declare-current-package": false, - "no-self-import": false + "no-self-import": false, + "no-return-await": false // used in tests } } diff --git a/types/ember/index.d.ts b/types/ember/index.d.ts index bb268646be..8a47f00476 100755 --- a/types/ember/index.d.ts +++ b/types/ember/index.d.ts @@ -1182,7 +1182,7 @@ declare module 'ember' { * argument for all items in the enumerable. This method is often simpler/faster * than using a callback. */ - isEvery(key: string, value: boolean): boolean; + isEvery(key: string, value: any): boolean; /** * Returns `true` if the passed function returns true for any item in the * enumeration. @@ -1193,7 +1193,7 @@ declare module 'ember' { * argument for any item in the enumerable. This method is often simpler/faster * than using a callback. */ - isAny(key: string, value?: boolean): boolean; + isAny(key: string, value?: any): boolean; /** * This will combine the values of the enumerator into a single value. It * is a useful way to collect a summary value from an enumeration. This diff --git a/types/ember/test/array.ts b/types/ember/test/array.ts index 38f0fad5c6..8416a4a9ec 100755 --- a/types/ember/test/array.ts +++ b/types/ember/test/array.ts @@ -15,7 +15,7 @@ const people = Ember.A([ assertType(people.get('length')); assertType(people.get('lastObject')); assertType(people.isAny('isHappy')); -assertType(people.isAny('isHappy', false)); +assertType(people.isAny('isHappy', 'false')); assertType>(people.filterBy('isHappy')); assertType>(people.rejectBy('isHappy')); assertType>(people.filter((person) => person.get('name') === 'Yehuda')); diff --git a/types/ember/test/ember-tests.ts b/types/ember/test/ember-tests.ts index 94de3bf259..f0aff2478c 100755 --- a/types/ember/test/ember-tests.ts +++ b/types/ember/test/ember-tests.ts @@ -131,7 +131,7 @@ const isHappy = (person: typeof Person3.prototype): boolean => { people2.every(isHappy); people2.any(isHappy); people2.isEvery('isHappy', true); -people2.isAny('isHappy', true); +people2.isAny('isHappy', 'true'); people2.isAny('isHappy'); // Examples taken from http://emberjs.com/api/classes/Em.RSVP.Promise.html diff --git a/types/es6-promisify/es6-promisify-tests.ts b/types/es6-promisify/es6-promisify-tests.ts index e2e004a950..e86c4f7f9e 100644 --- a/types/es6-promisify/es6-promisify-tests.ts +++ b/types/es6-promisify/es6-promisify-tests.ts @@ -1,6 +1,6 @@ /// -import promisify = require('es6-promisify'); +import { promisify } from 'es6-promisify'; function callbackFunction(a: string, b: string, callback: (error: any, combined: string) => void): void { callback(undefined, a + b); @@ -10,14 +10,8 @@ function multiArgFunction(a: string, b: string, c: string, callback: (error: any callback(undefined, a + c, b + c); } -const noKeys: promisify.Settings = {}; -const multiArgFunctionSettings: promisify.Settings = { - thisArg: multiArgFunction, - multiArgs: true -}; - const callbackPromiseFactory: (...args: any[]) => Promise = promisify(callbackFunction); -const multiArgPromiseFactory: (...args: any[]) => Promise = promisify(multiArgFunction, multiArgFunctionSettings); +const multiArgPromiseFactory: (...args: any[]) => Promise = promisify(multiArgFunction); const callbackPromise: Promise = callbackPromiseFactory('stringA', 'stringB'); const multiArgPromise: Promise = multiArgPromiseFactory('stringA', 'stringB', 'stringC'); diff --git a/types/es6-promisify/index.d.ts b/types/es6-promisify/index.d.ts index 8965b48503..1ce79ec210 100644 --- a/types/es6-promisify/index.d.ts +++ b/types/es6-promisify/index.d.ts @@ -1,24 +1,43 @@ -// Type definitions for es6-promisify 5.0 +// Type definitions for es6-promisify 6.0 // Project: https://github.com/digitaldesignlabs/es6-promisify#readme // Definitions by: Harry Shipton +// Brian Schlenker // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare function es6_promisify(original: (...args: any[]) => any, settings?: es6_promisify.Settings): ((...args: any[]) => Promise); - // If the issue at https://github.com/Microsoft/TypeScript/issues/1360 is fixed, -// then an update should be submitted replacing the above declaration with the -// following declarations. +// then an update should be submitted replacing the promisify declaration with +// the following declarations. /* -declare function es6_promisify(original: (...args: any[], callback: (error: any, arg: T) => any) => any, settings?: Settings): ((...args: any[]) => Promise); +function promisify(original: (...args: any[], callback: (error: any, arg: T) => any) => any): ((...args: any[]) => Promise); -declare function es6_promisify(original: (...args: any[], callback: (error: any, ...args: any[]) => any) => any, settings?: Settings): ((...args: any[]) => Promise); +function promisify(original: (...args: any[], callback: (error: any, ...args: any[]) => any) => any): ((...args: any[]) => Promise); */ -declare namespace es6_promisify { - interface Settings { - thisArg?: any; - multiArgs?: boolean; - } -} +export type Callback = (err: any, arg?: T) => any; +export type CallbackFunction = (...args: any[]) => any; +export type PromiseFunction = (...args: any[]) => Promise; -export = es6_promisify; +export function promisify(original: (cb: Callback) => any): + () => Promise; +export function promisify(original: (param1: U, cb: Callback) => any): + (param1: U) => Promise; +export function promisify(original: (param1: U, param2: V, cb: Callback) => any): + (param1: U, param2: V) => Promise; +export function promisify(original: (param1: U, param2: V, param3: W, cb: Callback) => any): + (param1: U, param2: V, param3: W) => Promise; +export function promisify(original: CallbackFunction): PromiseFunction; + +export namespace promisify { + /** + * This symbol can be placed on the function to be promisified to + * provide names as an array of strings for the values in a success + * callback. + */ + const argumentNames: symbol; + + /** + * The user can supply their own Promise implementation by setting it + * here. Otherwise, the global Promise object will be used. + */ + let Promise: PromiseConstructor; +} diff --git a/types/events/events-tests.ts b/types/events/events-tests.ts index ccf89c1402..67fe352225 100644 --- a/types/events/events-tests.ts +++ b/types/events/events-tests.ts @@ -53,6 +53,12 @@ setTimeout(() => { emitter.removeAllListeners('send'); }, 3000); +setTimeout(() => { + console.log('\n'); + emitter.emit('send', 'params1'); + emitter.removeAllListeners(); +}, 3000); + setTimeout(() => { console.log('\n'); emitter.emit(1); diff --git a/types/events/index.d.ts b/types/events/index.d.ts index 85ce0a7b0e..c9b08a4575 100644 --- a/types/events/index.d.ts +++ b/types/events/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for events 1.1 +// Type definitions for events 1.2 // Project: https://github.com/Gozala/events // Definitions by: Yasunori Ohoka // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -15,7 +15,7 @@ export class EventEmitter { on(type: string | number, listener: Listener): this; once(type: string | number, listener: Listener): this; removeListener(type: string | number, listener: Listener): this; - removeAllListeners(type: string | number): this; + removeAllListeners(type?: string | number): this; listeners(type: string | number): Listener[]; listenerCount(type: string | number): number; } diff --git a/types/expect/expect-tests.ts b/types/expect/expect-tests.ts index 41bdbe5581..fea4a3d4d9 100644 --- a/types/expect/expect-tests.ts +++ b/types/expect/expect-tests.ts @@ -88,6 +88,17 @@ describe('A spy', () => { expect(spy).toHaveBeenCalledWith(1, 2, 3); }); + it('knows the arguments it was last called with', () => { + spy(0, 1, 2); + spy(1, 2, 3); + expect(spy).toHaveBeenLastCalledWith(1, 2, 3); + }); + + it('accepts to have been called with any object', () => { + spy({}); + expect(spy).toHaveBeenCalledWith(expect.any(Object)); + }); + describe('that calls some other function', () => { let otherContext: any; let otherArguments: any; @@ -462,6 +473,66 @@ describe('toBeFalsy', () => { }); }); +describe('toBeDefined', () => { + it('does not throw on defined actual values', () => { + expect(() => { + expect(1).toBeDefined(); + expect(0).toBeDefined(); + expect(null).toBeDefined(); + }).toNotThrow(); + }); + + it('throws on undefined actual values', () => { + expect(() => { + expect(undefined).toBeDefined(); + }).toThrow(); + }); +}); + +describe('toBeUndefined', () => { + it('throws on defined values', () => { + expect(() => { + expect(42).toBeUndefined(); + }).toThrow(); + + expect(() => { + expect(0).toBeUndefined(); + }).toThrow(); + + expect(() => { + expect(null).toBeUndefined(); + }).toThrow(); + }); + + it('does not throw with undefined actual values', () => { + expect(() => { + expect(undefined).toBeUndefined(); + }).toNotThrow(); + }); +}); + +describe('toBeNull', () => { + it('throws on non-null values', () => { + expect(() => { + expect(42).toBeNull(); + }).toThrow(); + + expect(() => { + expect(0).toBeNull(); + }).toThrow(); + + expect(() => { + expect(undefined).toBeNull(); + }).toThrow(); + }); + + it('does not throw with null actual values', () => { + expect(() => { + expect(null).toBeNull(); + }).toNotThrow(); + }); +}); + describe('toEqual', () => { it('works', () => { expect(() => { @@ -953,6 +1024,36 @@ describe('expect(array).toNotMatch', () => { }); }); +describe('expect(object).toMatchObject', () => { + it('does not throw when the actual value matches', () => { + expect(() => { + expect({ + statusCode: 200, + headers: { + server: 'express web server' + } + }).toMatchObject({ + statusCode: 200, + headers: {} + }); + }).toNotThrow(); + }); + + it('throws when the actual value does not match', () => { + expect(() => { + expect({ + statusCode: 200, + headers: { + server: 'nginx web server' + } + }).toMatchObject({ + statusCode: 201, + headers: {} + }); + }).toThrow(/to match/); + }); +}); + describe('toNotEqual', () => { it('works', () => { expect('actual').toNotEqual('expected'); @@ -1100,3 +1201,17 @@ describe('withContext', () => { }).toThrow(/must be a function/); }); }); + +describe('not', () => { + it('does not throw on different values', () => { + expect(() => { + expect(1).not.toEqual(2); + }).toNotThrow(); + }); + + it('throws on equal values', () => { + expect(() => { + expect(1).not.toEqual(1); + }).toThrow(); + }); +}); diff --git a/types/expect/index.d.ts b/types/expect/index.d.ts index a37e8366f1..0e7ea18e91 100644 --- a/types/expect/index.d.ts +++ b/types/expect/index.d.ts @@ -14,6 +14,9 @@ declare namespace expect { toBeTruthy(message?: string): Expectation; toNotExist(message?: string): Expectation; toBeFalsy(message?: string): Expectation; + toBeNull(message?: string): Expectation; + toBeDefined(message?: string): Expectation; + toBeUndefined(message?: string): Expectation; toBe(value: T, message?: string): Expectation; toNotBe(value: any, message?: string): Expectation; @@ -28,6 +31,7 @@ declare namespace expect { toNotBeAn(value: string | {}, message?: string): Expectation; toMatch(value: string | RegExp | {}, message?: string): Expectation; toNotMatch(value: string | RegExp | {}, message?: string): Expectation; + toMatchObject(value: {}, message?: string): Expectation; toBeLessThan(value: number, message?: string): Expectation; toBeLessThanOrEqualTo(value: number, messasge?: string): Expectation; @@ -55,6 +59,9 @@ declare namespace expect { toHaveBeenCalled(message?: string): Expectation; toNotHaveBeenCalled(message?: string): Expectation; toHaveBeenCalledWith(...args: any[]): Expectation; + toHaveBeenLastCalledWith(...args: any[]): Expectation; + + not: Expectation; // deprecated withContext(context: any): Expectation; @@ -90,6 +97,7 @@ declare namespace expect { function restoreSpies(): void; function assert(condition: boolean, messageFormat: string, ...extraArgs: any[]): void; function extend(extension: Extension): void; + function any(ctor: { new (): T }): T; } declare function expect(actual: T): expect.Expectation; diff --git a/types/expo/expo-tests.tsx b/types/expo/expo-tests.tsx index 6a1f17ae3f..187d62b2ee 100644 --- a/types/expo/expo-tests.tsx +++ b/types/expo/expo-tests.tsx @@ -27,7 +27,10 @@ import { LinearGradient, Permissions, registerRootComponent, - ScreenOrientation + ScreenOrientation, + SQLite, + Calendar, + MailComposer } from 'expo'; Accelerometer.addListener((obj) => { @@ -207,7 +210,7 @@ const barcodeReadCallback = () => {}; ); @@ -515,9 +518,13 @@ KeepAwake.deactivate(); () => ( + start={[1, 1]} /> +); + +() => ( + ); Permissions.CAMERA === 'camera'; @@ -548,3 +555,124 @@ class __TestEntry__ extends React.Component { } } registerRootComponent(__TestEntry__); + +Calendar.EntityTypes.EVENT === 'event'; +Calendar.EntityTypes.REMINDER === 'reminder'; + +Calendar.CalendarType.LOCAL === 'local'; +Calendar.CalendarType.CALDAV === 'caldav'; +Calendar.CalendarType.EXCHANGE === 'exchange'; +Calendar.CalendarType.SUBSCRIBED === 'subscribed'; +Calendar.CalendarType.BIRTHDAYS === 'birthdays'; + +async () => { + const result = await Calendar.getCalendarsAsync(Calendar.EntityTypes.EVENT); + result.length; + + const calendar = result[0]; + calendar.id === ''; + calendar.title === ''; + calendar.sourceId === ''; + calendar.type === Calendar.CalendarType.BIRTHDAYS; + calendar.color === ''; + calendar.entityType === Calendar.EntityTypes.EVENT; + calendar.allowsModifications === true; + calendar.allowedAvailabilities === ['']; + calendar.isPrimary === true; + calendar.name === ''; + calendar.ownerAccount === ''; + calendar.timeZone === ''; + calendar.allowedReminders === ['']; + calendar.allowedAttendeeTypes === ['']; + calendar.isVisible === false; + calendar.isSynced === false; + calendar.accessLevel === Calendar.CalendarAccessLevel.CONTRIBUTOR; + + if (calendar.source) { + calendar.source.id === ''; + calendar.source.type === ''; + calendar.source.name === ''; + calendar.source.isLocalAccount === false; + } + + const id1 = await Calendar.createCalendarAsync({ + accessLevel: Calendar.CalendarAccessLevel.EDITOR + }); + + id1 === ''; + + const id2 = await Calendar.updateCalendarAsync('1234', { + isVisible: false + }); + + id2 === ''; + + const id3 = await Calendar.updateCalendarAsync('1234', null); + + await Calendar.deleteCalendarAsync('1234'); + + const events = await Calendar.getEventsAsync( + ['123', '124'], + new Date(), + new Date() + ); + + const event1 = events[0]; + + event1.accessLevel === Calendar.EventAccessLevel.CONFIDENTIAL; + event1.alarms === []; + event1.allDay === true; + event1.availability === Calendar.Availability.FREE; + event1.calendarId === ''; + event1.creationDate === ''; + event1.endDate === ''; + event1.endTimeZone === ''; + event1.guestsCanInviteOthers === true; + event1.guestsCanModify === true; + event1.guestsCanSeeGuests === false; + event1.id === ''; + event1.instanceId === ''; + event1.isDetached === false; + + const event2 = await Calendar.getEventAsync('123', { + futureEvents: true + }); + + const eventId1 = await Calendar.createEventAsync('123'); + + const eventId2 = await Calendar.updateEventAsync('1234'); + + await Calendar.deleteEventAsync('1234'); + + const attendees = await Calendar.getAttendeesForEventAsync('123'); + + const aId1 = await Calendar.createAttendeeAsync('123'); + + const aId2 = await Calendar.updateAttendeeAsync('123'); + + await Calendar.deleteAttendeeAsync('123'); + + const reminders = await Calendar.getRemindersAsync(['123']); + + const reminder = await Calendar.getReminderAsync('123'); + + const remId1 = await Calendar.createReminderAsync('123'); + + const remId2 = await Calendar.updateReminderAsync('123'); + + await Calendar.deleteReminderAsync('123'); + + const sources = await Calendar.getSourcesAsync(); + + const source = await Calendar.getSourceAsync('123'); + + Calendar.openEventInCalendar('123'); +}; + +async () => { + const result = await MailComposer.composeAsync({ + subject: 'sss' + }); + + result.status === 'saved'; +}; diff --git a/types/expo/index.d.ts b/types/expo/index.d.ts index ae7e45841d..a747a881e6 100644 --- a/types/expo/index.d.ts +++ b/types/expo/index.d.ts @@ -1,9 +1,10 @@ -// Type definitions for expo 24.0 +// Type definitions for expo 25.0 // Project: https://github.com/expo/expo-sdk // Definitions by: Konstantin Kai // Martynas Kadiša // Jan Aagaard // Sergio Sánchez +// Fernando Helwanger // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -632,7 +633,14 @@ export interface BarCodeScannerProps extends ViewProperties { onBarCodeRead?: BarCodeReadCallback; } -export class BarCodeScanner extends Component { } +export class BarCodeScanner extends Component { + static Constants: { + TorchMode: { + on: string; + off: string + } + } & CameraConstants; +} // #endregion // #region BlurView @@ -686,17 +694,21 @@ export class CameraObject { } export interface CameraProps extends ViewProperties { - flashMode?: string | number; - type?: string | number; - ratio?: string; - autoFocus?: string | number | boolean; - focusDepth?: FloatFromZeroToOne; zoom?: FloatFromZeroToOne; - whiteBalance?: string | number; - barCodeTypes?: string[]; + ratio?: string; + focusDepth?: FloatFromZeroToOne; + type?: string | number; onCameraReady?: () => void; - onMountError?: () => void; onBarCodeRead?: BarCodeReadCallback; + faceDetectionMode?: number; + flashMode?: string | number; + barCodeTypes?: Array; + whiteBalance?: string | number; + faceDetectionLandmarks?: number; + autoFocus?: string | number | boolean; + faceDetectionClassifications?: number; + onMountError?: () => void; + onFacesDetected?: (options: { faces: TrackedFaceFeature[] }) => void; ref?: Ref; } @@ -706,7 +718,28 @@ export interface CameraConstants { readonly AutoFocus: string; readonly WhiteBalance: string; readonly VideoQuality: string; - readonly BarCodeType: string; + readonly BarCodeType: { + aztec: string; + codabar: string; + code39: string; + code93: string; + code128: string; + code138: string; + code39mod43: string; + datamatrix: string; + ean13: string; + ean8: string; + interleaved2of5: string; + itf14: string; + maxicode: string; + pdf417: string; + rss14: string; + rssexpanded: string; + upc_a: string; + upc_e: string; + upc_ean: string; + qr: string; + }; } export class Camera extends Component { @@ -726,10 +759,14 @@ export namespace Constants { const isDevice: boolean; interface Platform { - ios: { + ios?: { platform: string; model: string; userInterfaceIdiom: string; + buildNumber: string; + }; + android?: { + versionCode: string; }; } const platform: Platform; @@ -1088,36 +1125,42 @@ export namespace FacebookAds { /** * FaceDetector */ +export interface Point { + x: Axis; + y: Axis; +} + +export interface FaceFeature { + bounds: { + size: { + width: number; + height: number; + }, + origin: Point; + }; + smilingProbability?: number; + leftEarPosition?: Point; + rightEarPosition?: Point; + leftEyePosition?: Point; + leftEyeOpenProbability?: number; + rightEyePosition?: Point; + rightEyeOpenProbability?: number; + leftCheekPosition?: Point; + rightCheekPosition?: Point; + leftMouthPosition?: Point; + mouthPosition?: Point; + rightMouthPosition?: Point; + bottomMouthPosition?: Point; + noseBasePosition?: Point; + yawAngle?: number; + rollAngle?: number; +} + +export interface TrackedFaceFeature extends FaceFeature { + faceID?: number; +} + export namespace FaceDetector { - interface Point { - x: Axis; - y: Axis; - } - interface FaceFeature { - bounds: { - size: { - width: number; - height: number; - }, - origin: Point; - }; - smilingProbability?: number; - leftEarPosition?: Point; - rightEarPosition?: Point; - leftEyePosition?: Point; - leftEyeOpenProbability?: number; - rightEyePosition?: Point; - rightEyeOpenProbability?: number; - leftCheekPosition?: Point; - rightCheekPosition?: Point; - leftMouthPosition?: Point; - mouthPosition?: Point; - rightMouthPosition?: Point; - bottomMouthPosition?: Point; - noseBasePosition?: Point; - yawAngle?: number; - rollAngle?: number; - } interface DetectFaceResult { faces: FaceFeature[]; image: { @@ -1153,7 +1196,6 @@ export namespace FaceDetector { function detectFaces(uri: string, options?: DetectionOptions): Promise; } - /** * FileSystem */ @@ -1509,11 +1551,11 @@ export class KeepAwake extends Component { /** * LinearGradient */ -export interface LinearGradientProps { +export interface LinearGradientProps extends ViewProperties { colors: string[]; - start: [number, number]; - end: [number, number]; - locations: number[]; + start?: [number, number]; + end?: [number, number]; + locations?: number[]; } export class LinearGradient extends Component { } @@ -1764,6 +1806,12 @@ export namespace Speech { function speak(text: string, options?: SpeechOptions): void; function stop(): void; function isSpeakingAsync(): Promise; + + /** Available on iOS only */ + function pause(): void; + + /** Available on iOS only */ + function resume(): void; } /** @@ -2070,3 +2118,561 @@ export namespace WebBrowser { function openAuthSessionAsync(url: string, redirectUrl?: string): Promise<{ type: 'cancelled' | 'dismissed' }>; function dismissBrowser(): Promise<{ type: 'dismissed' }>; } + +// #region Calendar +/** + * Calendar + * + * Provides an API for interacting with the device’s system calendars, events, reminders, and associated records. + */ +export namespace Calendar { + interface Calendar { + /** Internal ID that represents this calendar on the device */ + id?: string; + + /** Visible name of the calendar */ + title?: string; + + sourceId?: string; // iOS + + /** Object representing the source to be used for the calendar */ + source?: Source; + + /** Type of calendar this object represents */ + type?: CalendarType; // iOS + + /** Color used to display this calendar’s events */ + color?: string; + + /** Whether the calendar is used in the Calendar or Reminders OS app */ + entityType?: EntityTypes; // iOS + + /** Boolean value that determines whether this calendar can be modified */ + allowsModifications?: boolean; + + /** Availability types that this calendar supports */ + allowedAvailabilities?: Availability[]; + + /** Boolean value indicating whether this is the device’s primary calendar */ + isPrimary?: boolean; // Android + + /** Internal system name of the calendar */ + name?: string; // Android + + /** Name for the account that owns this calendar */ + ownerAccount?: string; // Android + + /** Time zone for the calendar */ + timeZone?: string; // Android + + /** Alarm methods that this calendar supports */ + allowedReminders?: AlarmMethod[]; // Android + + /** Attendee types that this calendar supports */ + allowedAttendeeTypes?: AttendeeType[]; // Android + + /** Indicates whether the OS displays events on this calendar */ + isVisible?: boolean; // Android + + /** Indicates whether this calendar is synced and its events stored on the device */ + isSynced?: boolean; // Android + + /** Level of access that the user has for the calendar */ + accessLevel?: CalendarAccessLevel; // Android + } + + interface Source { + /** Internal ID that represents this source on the device */ + id?: string; // iOS only ?? + + /** Type of account that owns this calendar */ + type?: string; + + /** Name for the account that owns this calendar */ + name?: string; + + /** Whether this source is the local phone account */ + isLocalAccount?: boolean; // Android + } + + interface Event { + /** Internal ID that represents this event on the device */ + id?: string; + + /** ID of the calendar that contains this event */ + calendarId?: string; + + /** Visible name of the event */ + title?: string; + + /** Location field of the event */ + location?: string; + + /** Date when the event record was created */ + creationDate?: string; // iOS + + /** Date when the event record was last modified */ + lastModifiedDate?: string; // iOS + + /** Time zone the event is scheduled in */ + timeZone?: string; + + /** Time zone for the event end time */ + endTimeZone?: string; // Android + + /** URL for the event */ + url?: string; // iOS + + /** Description or notes saved with the event */ + notes?: string; + + /** Array of Alarm objects which control automated reminders to the user */ + alarms?: Alarm[]; + + /** Object representing rules for recurring or repeating events. Null for one-time events. */ + recurrenceRule?: RecurrenceRule; + + /** Date object or string representing the time when the event starts */ + startDate?: string; + + /** Date object or string representing the time when the event ends */ + endDate?: string; + + /** For recurring events, the start date for the first (original) instance of the event */ + originalStartDate?: string; // iOS + + /** Boolean value indicating whether or not the event is a detached (modified) instance of a recurring event */ + isDetached?: boolean; // iOS + + /** Whether the event is displayed as an all-day event on the calendar */ + allDay?: boolean; + + /** The availability setting for the event */ + availability?: Availability; // Availability + + /** Status of the event */ + status?: EventStatus; // Status + + /** Organizer of the event, as an Attendee object */ + organizer?: string; // Organizer - iOS + + /** Email address of the organizer of the event */ + organizerEmail?: string; // Android + + /** User’s access level for the event */ + accessLevel?: EventAccessLevel; // Android, + + /** Whether invited guests can modify the details of the event */ + guestsCanModify?: boolean; // Android, + + /** Whether invited guests can invite other guests */ + guestsCanInviteOthers?: boolean; // Android + + /** Whether invited guests can see other guests */ + guestsCanSeeGuests?: boolean; // Android + + /** For detached (modified) instances of recurring events, the ID of the original recurring event */ + originalId?: string; // Android + + /** For instances of recurring events, volatile ID representing this instance; not guaranteed to always refer to the same instance */ + instanceId?: string; // Android + } + + interface Attendee { + /** Internal ID that represents this attendee on the device */ + id?: string; // Android + + /** Indicates whether or not this attendee is the current OS user */ + isCurrentUser?: boolean; // iOS + + /** Displayed name of the attendee */ + name?: string; + + /** Role of the attendee at the event */ + role?: AttendeeRole; + + /** Status of the attendee in relation to the event */ + status?: AttendeeStatus; + + /** Type of the attendee */ + type?: AttendeeType; + + /** URL for the attendee */ + url?: string; // iOS + + /** Email address of the attendee */ + email?: string; // Android + } + + interface Reminder { + /** Internal ID that represents this reminder on the device */ + id?: string; + + /** ID of the calendar that contains this reminder */ + calendarId?: string; + + /** Visible name of the reminder */ + title?: string; + + /** Location field of the reminder */ + location?: string; + + /** Date when the reminder record was created */ + creationDate?: string; + + /** Date when the reminder record was last modified */ + lastModifiedDate?: string; + + /** Time zone the reminder is scheduled in */ + timeZone?: string; + + /** URL for the reminder */ + url?: string; + + /** Description or notes saved with the reminder */ + notes?: string; + + /** Array of Alarm objects which control automated alarms to the user about the task */ + alarms?: Alarm[]; + + /** Object representing rules for recurring or repeated reminders. Null for one-time tasks. */ + recurrenceRule?: RecurrenceRule; + + /** Date object or string representing the start date of the reminder task */ + startDate?: string; + + /** Date object or string representing the time when the reminder task is due */ + dueDate?: string; + + /** Indicates whether or not the task has been completed */ + completed?: boolean; + + /** Date object or string representing the date of completion, if completed is true */ + completionDate?: string; + } + + interface Alarm { + /** Date object or string representing an absolute time the alarm should occur; overrides relativeOffset and structuredLocation if specified alongside either */ + absoluteDate?: string; // iOS + + /** Number of minutes from the startDate of the calendar item that the alarm should occur; use negative values to have the alarm occur before the startDate */ + relativeOffset?: string; + structuredLocation?: { + // iOS + title?: string; + proximity?: string; // Proximity + radius?: number; + coords?: { + latitude?: number; + longitude?: number; + }; + }; + + /** Method of alerting the user that this alarm should use; on iOS this is always a notification */ + method?: AlarmMethod; // Method, Android + } + + interface RecurrenceRule { + /** How often the calendar item should recur */ + frequency: Frequency; // Frequency + + /** Interval at which the calendar item should recur. For example, an interval: 2 with frequency: DAILY would yield an event that recurs every other day. Defaults to 1 . */ + interval?: number; + + /** Date on which the calendar item should stop recurring; overrides occurrence if both are specified */ + endDate?: string; + + /** Number of times the calendar item should recur before stopping */ + occurrence?: number; + } + + enum EntityTypes { + EVENT = 'event', + REMINDER = 'reminder', + } + + enum CalendarType { + LOCAL = 'local', + CALDAV = 'caldav', + EXCHANGE = 'exchange', + SUBSCRIBED = 'subscribed', + BIRTHDAYS = 'birthdays' + } + + enum Availability { + NOT_SUPPORTED = 'notSupported', // iOS + BUSY = 'busy', + FREE = 'free', + TENTATIVE = 'tentative', + UNAVAILABLE = 'unavailable' // iOS + } + + enum AlarmMethod { + ALARM = 'alarm', + ALERT = 'alert', + EMAIL = 'email', + SMS = 'sms', + DEFAULT = 'default', + } + + enum AttendeeType { + UNKNOWN = 'unknown', // iOS + PERSON = 'person', // iOS + ROOM = 'room', // iOS + GROUP = 'group', // iOS + RESOURCE = 'resource', + OPTIONAL = 'optional', // Android + REQUIRED = 'required', // Android + NONE = 'none' // Android + } + + enum CalendarAccessLevel { + CONTRIBUTOR = 'contributor', + EDITOR = 'editor', + FREEBUSY = 'freebusy', + OVERRIDE = 'override', + OWNER = 'owner', + READ = 'read', + RESPOND = 'respond', + ROOT = 'root', + NONE = 'none' + } + + enum EventAccessLevel { + CONFIDENTIAL = 'confidential', + PRIVATE = 'private', + PUBLIC = 'public', + DEFAULT = 'default' + } + + enum EventStatus { + NONE = 'none', + CONFIRMED = 'confirmed', + TENTATIVE = 'tentative', + CANCELED = 'canceled' + } + + enum AttendeeRole { + UNKNOWN = 'unknown', // iOS + REQUIRED = 'required', // iOS + OPTIONAL = 'optional', // iOS + CHAIR = 'chair', // iOS + NON_PARTICIPANT = 'nonParticipant', // iOS + ATTENDEE = 'attendee', // Android + ORGANIZER = 'organizer', // Android + PERFORMER = 'performer', // Android + SPEAKER = 'speaker', // Android + NONE = 'none' // Android + } + + enum AttendeeStatus { + UNKNOWN = 'unknown', // iOS + PENDING = 'pending', // iOS + ACCEPTED = 'accepted', + DECLINED = 'declined', + TENTATIVE = 'tentative', + DELEGATED = 'delegated', // iOS + COMPLETED = 'completed', // iOS + IN_PROCESS = 'inProcess', // iOS + INVITED = 'invited', // Android + NONE = 'none' // Android + } + + enum Frequency { + DAILY = 'daily', + WEEKLY = 'weekly', + MONTHLY = 'monthly', + YEARLY = 'yearly' + } + + enum ReminderStatus { + COMPLETED = 'completed', + INCOMPLETE = 'incomplete' + } + + interface RecurringEventOptions { + futureEvents?: boolean; + instanceStartDate?: string; + } + + /** Gets an array of calendar objects with details about the different calendars stored on the device. */ + function getCalendarsAsync( + /** (iOS only) Not required, but if defined, filters the returned calendars to a specific entity type. */ + entityType?: EntityTypes + ): Promise; + + /** Creates a new calendar on the device, allowing events to be added later and displayed. */ + function createCalendarAsync(details: Calendar): Promise; + + /** Updates the provided details of an existing calendar stored on the device. To remove a property, explicitly set it to null in details */ + function updateCalendarAsync(id: string, details?: Calendar | null): Promise; + + /** Deletes an existing calendar and all associated events/reminders/attendees from the device. Use with caution. */ + function deleteCalendarAsync(id: string): Promise; + + /** Returns all events in a given set of calendars over a specified time period. */ + function getEventsAsync( + /** Array of IDs of calendars to search for events in. Required. */ + calendarIds: string[], + + /** Beginning of time period to search for events in. Required. */ + startDate: Date, + + /** End of time period to search for events in. Required. */ + endDate: Date + ): Promise; + + /** Returns a specific event selected by ID. If a specific instance of a recurring event is desired, the start date of this instance must also be provided, as instances of recurring events do not have their own unique and stable IDs on either iOS or Android. */ + function getEventAsync( + /** ID of the event to return. Required. */ + id: string, + + /** A map of options for recurring events */ + recurringEventOptions?: RecurringEventOptions + ): Promise; + + /** Creates a new event on the specified calendar. */ + function createEventAsync( + /** ID of the calendar to create this event in. Required. */ + calendarId: string, + details?: Event + ): Promise; + + /** Updates the provided details of an existing calendar stored on the device. To remove a property, explicitly set it to null in details */ + function updateEventAsync( + /** ID of the event to be updated. Required. */ + id: string, + + /** A map of properties to be updated */ + details?: Event | null, + + /** A map of options for recurring events */ + recurrentEventOptions?: RecurringEventOptions + ): Promise; + + /** Deletes an existing event from the device. Use with caution. */ + function deleteEventAsync( + /** ID of the event to be deleted. Required. */ + id: string, + + /** A map of options for recurring events */ + recurringEventOptions?: RecurringEventOptions + ): Promise; + + /** Gets all attendees for a given event (or instance of a recurring event). */ + function getAttendeesForEventAsync( + /** ID of the event to return attendees for. Required. */ + eventId: string, + + /** A map of options for recurring events */ + recurrentEventOptions?: RecurringEventOptions + ): Promise; + + /** Available on Android only. Creates a new attendee record and adds it to the specified event. Note that if eventId specifies a recurring event, this will add the attendee to every instance of the event. */ + function createAttendeeAsync( + /** ID of the event to add this attendee to. Required. */ + eventId: string, + + /** A map of details for the attendee to be created */ + details?: Attendee + ): Promise; + + /** Available on Android only. Updates an existing attendee record. To remove a property, explicitly set it to null in details. */ + function updateAttendeeAsync( + /** ID of the attendee record to be updated. Required. */ + id: string, + + /** A map of properties to be updated */ + details?: Attendee | null + ): Promise; + + /** Available on Android only. Deletes an existing attendee record from the device. Use with caution. */ + function deleteAttendeeAsync(id: string): Promise; + + /** Available on iOS only. Returns a list of reminders matching the provided criteria. */ + function getRemindersAsync( + /** Array of IDs of calendars to search for reminders in. Required. */ + calendarIds: string[], + + status?: ReminderStatus, + + /** Beginning of time period to search for reminders in. Required if status is defined. */ + startDate?: Date, + + /** End of time period to search for reminders in. Required if status is defined. */ + endDate?: Date + ): Promise; + + /** Available on iOS only. Returns a specific reminder selected by ID. */ + function getReminderAsync(id: string): Promise; + + /** Available on iOS only. Creates a new reminder on the specified calendar. */ + function createReminderAsync( + /** ID of the calendar to create this reminder in. Required. */ + calendarId: string, + + /** A map of details for the reminder to be created */ + details?: Reminder + ): Promise; + + /** Available on iOS only. Updates the provided details of an existing reminder stored on the device. To remove a property, explicitly set it to null in details. */ + function updateReminderAsync( + /** ID of the reminder to be updated. Required. */ + id: string, + + /** A map of properties to be updated */ + details?: Reminder | null + ): Promise; + + /** Available on iOS only. Deletes an existing reminder from the device. Use with caution. */ + function deleteReminderAsync(id: string): Promise; + + /** Available on iOS only. */ + function getSourcesAsync(): Promise; + + /** Available on iOS only. Returns a specific source selected by ID. */ + function getSourceAsync(id: string): Promise; + + /** Available on Android only. Sends an intent to open the specified event in the OS Calendar app. */ + function openEventInCalendar( + /** ID of the event to open. Required. */ + id: string + ): void; +} +// #endregion + +// #region Calendar +/** + * An API to compose mails using OS specific UI. + */ +export namespace MailComposer { + interface ComposeOptions { + /** An array of e-mail addressess of the recipients. */ + recipients?: string[]; + + /** An array of e-mail addressess of the CC recipients. */ + ccRecipients?: string[]; + + /** An array of e-mail addressess of the BCC recipients. */ + bccRecipients?: string[]; + + /** Subject of the mail. */ + subject?: string; + + /** Body of the mail. */ + body?: string; + + /** Whether the body contains HTML tags so it could be formatted properly. Not working perfectly on Android. */ + isHtml?: boolean; + + /** An array of app’s internal file uris to attach. */ + attachments?: string[]; + } + + /** Resolves to a promise with object containing status field that could be either sent, saved or cancelled. Android does not provide such info so it always resolves to sent. */ + function composeAsync( + /** A map defining the data to fill the mail */ + options: ComposeOptions + ): Promise<{ status: 'sent' | 'saved' | 'cancelled' }>; +} +// #endregion diff --git a/types/expo/v24/expo-tests.tsx b/types/expo/v24/expo-tests.tsx new file mode 100644 index 0000000000..77f9bbba87 --- /dev/null +++ b/types/expo/v24/expo-tests.tsx @@ -0,0 +1,554 @@ +import * as React from 'react'; +import { Text } from 'react-native'; + +import { + Accelerometer, + Amplitude, + Asset, + AuthSession, + Audio, + AppLoading, + BarCodeScanner, + BlurViewProps, + BlurView, + Brightness, + Camera, + CameraObject, + DocumentPicker, + Facebook, + FacebookAds, + FileSystem, + ImagePicker, + ImageManipulator, + FaceDetector, + Svg, + IntentLauncherAndroid, + KeepAwake, + LinearGradient, + Permissions, + registerRootComponent, + ScreenOrientation +} from 'expo'; + +Accelerometer.addListener((obj) => { + obj.x; + obj.y; + obj.z; +}); +Accelerometer.removeAllListeners(); +Accelerometer.setUpdateInterval(1000); + +Amplitude.initialize('key'); +Amplitude.setUserId('userId'); +Amplitude.setUserProperties({key: 1}); +Amplitude.clearUserProperties(); +Amplitude.logEvent('name'); +Amplitude.logEventWithProperties('event', {key: 'value'}); +Amplitude.setGroup('type', ['value']); + +const asset = Asset.fromModule(1); +asset.downloadAsync(); +Asset.loadAsync(1); +Asset.loadAsync([1, 2, 3]); +const asset1 = new Asset({ + uri: 'uri', + type: 'type', + name: 'name', + hash: 'hash', + width: 122, + height: 122 +}); + +const url = AuthSession.getRedirectUrl(); +AuthSession.dismiss(); +AuthSession.startAsync({ + authUrl: 'url1', + returnUrl: 'url2' +}).then(result => { + switch (result.type) { + case 'success': + result.event; + result.params; + break; + case 'error': + result.errorCode; + result.params; + result.event; + break; + case 'dismissed': + case 'cancel': + result.type; + break; + } +}); +AuthSession.startAsync({ + authUrl: 'url1', + returnUrl: undefined +}); + +Audio.setAudioModeAsync({ + shouldDuckAndroid: false, + playsInSilentModeIOS: true, + interruptionModeIOS: 2, + interruptionModeAndroid: 1, + allowsRecordingIOS: true +}); +Audio.setIsEnabledAsync(true); + +Audio.INTERRUPTION_MODE_IOS_MIX_WITH_OTHERS === 0; +Audio.INTERRUPTION_MODE_IOS_DO_NOT_MIX === 1; +Audio.INTERRUPTION_MODE_IOS_DUCK_OTHERS === 2; + +Audio.INTERRUPTION_MODE_ANDROID_DO_NOT_MIX === 1; +Audio.INTERRUPTION_MODE_ANDROID_DUCK_OTHERS === 2; + +Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_DEFAULT === 0; +Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_THREE_GPP === 1; +Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_MPEG_4 === 2; +Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_AMR_NB === 3; +Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_AMR_WB === 4; +Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_AAC_ADIF === 5; +Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_AAC_ADTS === 6; +Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_RTP_AVP === 7; +Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_MPEG2TS === 8; +Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_WEBM === 9; + +Audio.RECORDING_OPTION_ANDROID_AUDIO_ENCODER_DEFAULT === 0; +Audio.RECORDING_OPTION_ANDROID_AUDIO_ENCODER_AMR_NB === 1; +Audio.RECORDING_OPTION_ANDROID_AUDIO_ENCODER_AMR_WB === 2; +Audio.RECORDING_OPTION_ANDROID_AUDIO_ENCODER_AAC === 3; +Audio.RECORDING_OPTION_ANDROID_AUDIO_ENCODER_HE_AAC === 4; +Audio.RECORDING_OPTION_ANDROID_AUDIO_ENCODER_AAC_ELD === 5; +Audio.RECORDING_OPTION_ANDROID_AUDIO_ENCODER_VORBIS === 6; + +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_LINEARPCM === 'lpcm'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_AC3 === 'ac-3'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_60958AC3 === 'cac3'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_APPLEIMA4 === 'ima4'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC === 'aac '; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4CELP === 'celp'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4HVXC === 'hvxc'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4TWINVQ === 'twvq'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MACE3 === 'MAC3'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MACE6 === 'MAC6'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_ULAW === 'ulaw'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_ALAW === 'alaw'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_QDESIGN === 'QDMC'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_QDESIGN2 === 'QDM2'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_QUALCOMM === 'Qclp'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEGLAYER1 === '.mp1'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEGLAYER2 === '.mp2'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEGLAYER3 === '.mp3'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_APPLELOSSLESS === 'alac'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_HE === 'aach'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_LD === 'aacl'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_ELD === 'aace'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_ELD_SBR === 'aacf'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_ELD_V2 === 'aacg'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_HE_V2 === 'aacp'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_SPATIAL === 'aacs'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_AMR === 'samr'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_AMR_WB === 'sawb'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_AUDIBLE === 'AUDB'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_ILBC === 'ilbc'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_DVIINTELIMA === 0x6d730011; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_MICROSOFTGSM === 0x6d730031; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_AES3 === 'aes3'; +Audio.RECORDING_OPTION_IOS_OUTPUT_FORMAT_ENHANCEDAC3 === 'ec-3'; + +Audio.RECORDING_OPTION_IOS_AUDIO_QUALITY_MIN === 0; +Audio.RECORDING_OPTION_IOS_AUDIO_QUALITY_LOW === 0x20; +Audio.RECORDING_OPTION_IOS_AUDIO_QUALITY_MEDIUM === 0x40; +Audio.RECORDING_OPTION_IOS_AUDIO_QUALITY_HIGH === 0x60; +Audio.RECORDING_OPTION_IOS_AUDIO_QUALITY_MAX === 0x7f; + +Audio.RECORDING_OPTION_IOS_BIT_RATE_STRATEGY_CONSTANT === 0; +Audio.RECORDING_OPTION_IOS_BIT_RATE_STRATEGY_LONG_TERM_AVERAGE === 1; +Audio.RECORDING_OPTION_IOS_BIT_RATE_STRATEGY_VARIABLE_CONSTRAINED === 2; +Audio.RECORDING_OPTION_IOS_BIT_RATE_STRATEGY_VARIABLE === 3; + +Audio.RECORDING_OPTIONS_PRESET_HIGH_QUALITY; +Audio.RECORDING_OPTIONS_PRESET_LOW_QUALITY; +async () => { + const result = await Audio.Sound.create({uri: 'uri'}, { + volume: 0.5, + rate: 0.6 + }, null, true); + + const sound = result.sound; + const status = result.status; + + if (!status.isLoaded) { + status.error; + } else { + status.didJustFinish; + // etc. + } + + const _status = await sound.getStatusAsync(); + await sound.loadAsync({uri: 'uri'}); +}; + +() => ( + Promise.resolve()} + onFinish={() => {}} + onError={(error) => console.log(error)} /> +); +() => ( + +); + +const barcodeReadCallback = () => {}; +() => ( + +); + +() => ( + +); + +async () => { + await Brightness.setBrightnessAsync(.6); + await Brightness.setSystemBrightnessAsync(.7); + const br1 = await Brightness.getBrightnessAsync(); + const br2 = await Brightness.getSystemBrightnessAsync(); +}; + +Camera.Constants.AutoFocus; +Camera.Constants.Type; +Camera.Constants.FlashMode; +Camera.Constants.WhiteBalance; +Camera.Constants.VideoQuality; +Camera.Constants.BarCodeType; +() => { + return( { + if (component) { + component.recordAsync(); + } + }} />); +}; + +async () => { + const result = await DocumentPicker.getDocumentAsync(); + + if (result.type === 'success') { + result.name; + result.uri; + result.size; + } +}; + +async () => { + const { type, expires, token } = await Facebook.logInWithReadPermissionsAsync("appId"); +}; + +() => ( + {}} + onError={() => {}} /> +); + +async () => { + const info = await FileSystem.getInfoAsync('file'); + + info.exists; + info.isDirectory; + + if (info.exists) { + info.md5; + info.uri; + info.size; + info.modificationTime; + } + + const string: string = await FileSystem.readAsStringAsync('file'); + await FileSystem.writeAsStringAsync('file', 'content'); + await FileSystem.deleteAsync('file'); + await FileSystem.moveAsync({ from: 'from', to: 'to'}); + await FileSystem.copyAsync({ from: 'from', to: 'to' }); + await FileSystem.makeDirectoryAsync('dir'); + const dirs: string[] = await FileSystem.readDirectoryAsync('dir'); + const result = await FileSystem.downloadAsync('from', 'to'); + + result.headers; + result.status; + result.uri; + result.md5; +}; + +async () => { + const result = await ImagePicker.launchImageLibraryAsync({ + mediaTypes: ImagePicker.MediaTypeOptions.Videos + }); + + if (!result.cancelled) { + result.uri; + result.width; + result.height; + } +}; + +async () => { + const result = await ImageManipulator.manipulate('url', { + rotate: 90 + }, { + compress: 0.5 + }); + + result.height; + result.uri; + result.width; +}; + +FaceDetector.Constants.Mode.fast; +FaceDetector.Constants.Mode.accurate; +FaceDetector.Constants.Landmarks.all; +FaceDetector.Constants.Landmarks.none; +FaceDetector.Constants.Classifications.all; +FaceDetector.Constants.Classifications.none; +async () => { + const result = await FaceDetector.detectFaces('url', { + mode: FaceDetector.Constants.Mode.fast, + detectLandmarks: FaceDetector.Constants.Landmarks.all, + runClassifications: FaceDetector.Constants.Classifications.none + }); + + result.faces[0]; +}; + +() => ( + + + + + + + + + STROKED TEXT + + + + + + + + We go up and down, + then up again + + + + + + + + + + + + + + + + + + + + + +); + +IntentLauncherAndroid.ACTION_ACCESSIBILITY_SETTINGS === 'android.settings.ACCESSIBILITY_SETTINGS'; +IntentLauncherAndroid.ACTION_APP_NOTIFICATION_REDACTION === 'android.settings.ACTION_APP_NOTIFICATION_REDACTION'; +IntentLauncherAndroid.ACTION_CONDITION_PROVIDER_SETTINGS === 'android.settings.ACTION_CONDITION_PROVIDER_SETTINGS'; +IntentLauncherAndroid.ACTION_NOTIFICATION_LISTENER_SETTINGS === 'android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS'; +IntentLauncherAndroid.ACTION_PRINT_SETTINGS === 'android.settings.ACTION_PRINT_SETTINGS'; +IntentLauncherAndroid.ACTION_ADD_ACCOUNT_SETTINGS === 'android.settings.ADD_ACCOUNT_SETTINGS'; +IntentLauncherAndroid.ACTION_AIRPLANE_MODE_SETTINGS === 'android.settings.AIRPLANE_MODE_SETTINGS'; +IntentLauncherAndroid.ACTION_APN_SETTINGS === 'android.settings.APN_SETTINGS'; +IntentLauncherAndroid.ACTION_APPLICATION_DETAILS_SETTINGS === 'android.settings.APPLICATION_DETAILS_SETTINGS'; +IntentLauncherAndroid.ACTION_APPLICATION_DEVELOPMENT_SETTINGS === 'android.settings.APPLICATION_DEVELOPMENT_SETTINGS'; +IntentLauncherAndroid.ACTION_APPLICATION_SETTINGS === 'android.settings.APPLICATION_SETTINGS'; +IntentLauncherAndroid.ACTION_APP_NOTIFICATION_SETTINGS === 'android.settings.APP_NOTIFICATION_SETTINGS'; +IntentLauncherAndroid.ACTION_APP_OPS_SETTINGS === 'android.settings.APP_OPS_SETTINGS'; +IntentLauncherAndroid.ACTION_BATTERY_SAVER_SETTINGS === 'android.settings.BATTERY_SAVER_SETTINGS'; +IntentLauncherAndroid.ACTION_BLUETOOTH_SETTINGS === 'android.settings.BLUETOOTH_SETTINGS'; +IntentLauncherAndroid.ACTION_CAPTIONING_SETTINGS === 'android.settings.CAPTIONING_SETTINGS'; +IntentLauncherAndroid.ACTION_CAST_SETTINGS === 'android.settings.CAST_SETTINGS'; +IntentLauncherAndroid.ACTION_DATA_ROAMING_SETTINGS === 'android.settings.DATA_ROAMING_SETTINGS'; +IntentLauncherAndroid.ACTION_DATE_SETTINGS === 'android.settings.DATE_SETTINGS'; +IntentLauncherAndroid.ACTION_DEVICE_INFO_SETTINGS === 'android.settings.DEVICE_INFO_SETTINGS'; +IntentLauncherAndroid.ACTION_DEVICE_NAME === 'android.settings.DEVICE_NAME'; +IntentLauncherAndroid.ACTION_DISPLAY_SETTINGS === 'android.settings.DISPLAY_SETTINGS'; +IntentLauncherAndroid.ACTION_DREAM_SETTINGS === 'android.settings.DREAM_SETTINGS'; +IntentLauncherAndroid.ACTION_HARD_KEYBOARD_SETTINGS === 'android.settings.HARD_KEYBOARD_SETTINGS'; +IntentLauncherAndroid.ACTION_HOME_SETTINGS === 'android.settings.HOME_SETTINGS'; +IntentLauncherAndroid.ACTION_IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS === 'android.settings.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS'; +IntentLauncherAndroid.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS === 'android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS'; +IntentLauncherAndroid.ACTION_INPUT_METHOD_SETTINGS === 'android.settings.INPUT_METHOD_SETTINGS'; +IntentLauncherAndroid.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS === 'android.settings.INPUT_METHOD_SUBTYPE_SETTINGS'; +IntentLauncherAndroid.ACTION_INTERNAL_STORAGE_SETTINGS === 'android.settings.INTERNAL_STORAGE_SETTINGS'; +IntentLauncherAndroid.ACTION_LOCALE_SETTINGS === 'android.settings.LOCALE_SETTINGS'; +IntentLauncherAndroid.ACTION_LOCATION_SOURCE_SETTINGS === 'android.settings.LOCATION_SOURCE_SETTINGS'; +IntentLauncherAndroid.ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS === 'android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS'; +IntentLauncherAndroid.ACTION_MANAGE_APPLICATIONS_SETTINGS === 'android.settings.MANAGE_APPLICATIONS_SETTINGS'; +IntentLauncherAndroid.ACTION_MANAGE_DEFAULT_APPS_SETTINGS === 'android.settings.MANAGE_DEFAULT_APPS_SETTINGS'; +IntentLauncherAndroid.ACTION_MEMORY_CARD_SETTINGS === 'android.settings.MEMORY_CARD_SETTINGS'; +IntentLauncherAndroid.ACTION_MONITORING_CERT_INFO === 'android.settings.MONITORING_CERT_INFO'; +IntentLauncherAndroid.ACTION_NETWORK_OPERATOR_SETTINGS === 'android.settings.NETWORK_OPERATOR_SETTINGS'; +IntentLauncherAndroid.ACTION_NFCSHARING_SETTINGS === 'android.settings.NFCSHARING_SETTINGS'; +IntentLauncherAndroid.ACTION_NFC_PAYMENT_SETTINGS === 'android.settings.NFC_PAYMENT_SETTINGS'; +IntentLauncherAndroid.ACTION_NFC_SETTINGS === 'android.settings.NFC_SETTINGS'; +IntentLauncherAndroid.ACTION_NIGHT_DISPLAY_SETTINGS === 'android.settings.NIGHT_DISPLAY_SETTINGS'; +IntentLauncherAndroid.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS === 'android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS'; +IntentLauncherAndroid.ACTION_NOTIFICATION_SETTINGS === 'android.settings.NOTIFICATION_SETTINGS'; +IntentLauncherAndroid.ACTION_PAIRING_SETTINGS === 'android.settings.PAIRING_SETTINGS'; +IntentLauncherAndroid.ACTION_PRIVACY_SETTINGS === 'android.settings.PRIVACY_SETTINGS'; +IntentLauncherAndroid.ACTION_QUICK_LAUNCH_SETTINGS === 'android.settings.QUICK_LAUNCH_SETTINGS'; +IntentLauncherAndroid.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS === 'android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS'; +IntentLauncherAndroid.ACTION_SECURITY_SETTINGS === 'android.settings.SECURITY_SETTINGS'; +IntentLauncherAndroid.ACTION_SETTINGS === 'android.settings.SETTINGS'; +IntentLauncherAndroid.ACTION_SHOW_ADMIN_SUPPORT_DETAILS === 'android.settings.SHOW_ADMIN_SUPPORT_DETAILS'; +IntentLauncherAndroid.ACTION_SHOW_INPUT_METHOD_PICKER === 'android.settings.SHOW_INPUT_METHOD_PICKER'; +IntentLauncherAndroid.ACTION_SHOW_REGULATORY_INFO === 'android.settings.SHOW_REGULATORY_INFO'; +IntentLauncherAndroid.ACTION_SHOW_REMOTE_BUGREPORT_DIALOG === 'android.settings.SHOW_REMOTE_BUGREPORT_DIALOG'; +IntentLauncherAndroid.ACTION_SOUND_SETTINGS === 'android.settings.SOUND_SETTINGS'; +IntentLauncherAndroid.ACTION_STORAGE_MANAGER_SETTINGS === 'android.settings.STORAGE_MANAGER_SETTINGS'; +IntentLauncherAndroid.ACTION_SYNC_SETTINGS === 'android.settings.SYNC_SETTINGS'; +IntentLauncherAndroid.ACTION_SYSTEM_UPDATE_SETTINGS === 'android.settings.SYSTEM_UPDATE_SETTINGS'; +IntentLauncherAndroid.ACTION_TETHER_PROVISIONING_UI === 'android.settings.TETHER_PROVISIONING_UI'; +IntentLauncherAndroid.ACTION_TRUSTED_CREDENTIALS_USER === 'android.settings.TRUSTED_CREDENTIALS_USER'; +IntentLauncherAndroid.ACTION_USAGE_ACCESS_SETTINGS === 'android.settings.USAGE_ACCESS_SETTINGS'; +IntentLauncherAndroid.ACTION_USER_DICTIONARY_INSERT === 'android.settings.USER_DICTIONARY_INSERT'; +IntentLauncherAndroid.ACTION_USER_DICTIONARY_SETTINGS === 'android.settings.USER_DICTIONARY_SETTINGS'; +IntentLauncherAndroid.ACTION_USER_SETTINGS === 'android.settings.USER_SETTINGS'; +IntentLauncherAndroid.ACTION_VOICE_CONTROL_AIRPLANE_MODE === 'android.settings.VOICE_CONTROL_AIRPLANE_MODE'; +IntentLauncherAndroid.ACTION_VOICE_CONTROL_BATTERY_SAVER_MODE === 'android.settings.VOICE_CONTROL_BATTERY_SAVER_MODE'; +IntentLauncherAndroid.ACTION_VOICE_CONTROL_DO_NOT_DISTURB_MODE === 'android.settings.VOICE_CONTROL_DO_NOT_DISTURB_MODE'; +IntentLauncherAndroid.ACTION_VOICE_INPUT_SETTINGS === 'android.settings.VOICE_INPUT_SETTINGS'; +IntentLauncherAndroid.ACTION_VPN_SETTINGS === 'android.settings.VPN_SETTINGS'; +IntentLauncherAndroid.ACTION_VR_LISTENER_SETTINGS === 'android.settings.VR_LISTENER_SETTINGS'; +IntentLauncherAndroid.ACTION_WEBVIEW_SETTINGS === 'android.settings.WEBVIEW_SETTINGS'; +IntentLauncherAndroid.ACTION_WIFI_IP_SETTINGS === 'android.settings.WIFI_IP_SETTINGS'; +IntentLauncherAndroid.ACTION_WIFI_SETTINGS === 'android.settings.WIFI_SETTINGS'; +IntentLauncherAndroid.ACTION_WIRELESS_SETTINGS === 'android.settings.WIRELESS_SETTINGS'; +IntentLauncherAndroid.ACTION_ZEN_MODE_AUTOMATION_SETTINGS === 'android.settings.ZEN_MODE_AUTOMATION_SETTINGS'; +IntentLauncherAndroid.ACTION_ZEN_MODE_EVENT_RULE_SETTINGS === 'android.settings.ZEN_MODE_EVENT_RULE_SETTINGS'; +IntentLauncherAndroid.ACTION_ZEN_MODE_EXTERNAL_RULE_SETTINGS === 'android.settings.ZEN_MODE_EXTERNAL_RULE_SETTINGS'; +IntentLauncherAndroid.ACTION_ZEN_MODE_PRIORITY_SETTINGS === 'android.settings.ZEN_MODE_PRIORITY_SETTINGS'; +IntentLauncherAndroid.ACTION_ZEN_MODE_SCHEDULE_RULE_SETTINGS === 'android.settings.ZEN_MODE_SCHEDULE_RULE_SETTINGS'; +IntentLauncherAndroid.ACTION_ZEN_MODE_SETTINGS === 'android.settings.ZEN_MODE_SETTINGS'; + +KeepAwake.activate(); +KeepAwake.deactivate(); + +() => ( + +); + +() => ( + +); + +Permissions.CAMERA === 'camera'; +Permissions.CAMERA_ROLL === 'cameraRoll'; +Permissions.AUDIO_RECORDING === 'audioRecording'; +Permissions.CONTACTS === 'contacts'; +Permissions.NOTIFICATIONS === 'remoteNotifications'; +Permissions.REMOTE_NOTIFICATIONS === 'remoteNotifications'; +Permissions.SYSTEM_BRIGHTNESS === 'systemBrightness'; +async () => { + const result = await Permissions.askAsync(Permissions.CAMERA); + + result.status === 'granted'; + result.status === 'denied'; + result.status === 'undetermined'; + + result.expires === 'never'; +}; + +ScreenOrientation.Orientation.ALL; +ScreenOrientation.allow(ScreenOrientation.Orientation.ALL); + +class __TestEntry__ extends React.Component { + render() { + return( + test + ); + } +} +registerRootComponent(__TestEntry__); diff --git a/types/expo/v24/index.d.ts b/types/expo/v24/index.d.ts new file mode 100644 index 0000000000..4bf5e48dc9 --- /dev/null +++ b/types/expo/v24/index.d.ts @@ -0,0 +1,2101 @@ +// Type definitions for expo 24.0 +// Project: https://github.com/expo/expo-sdk +// Definitions by: Konstantin Kai +// Martynas Kadiša +// Jan Aagaard +// Sergio Sánchez +// Fernando Helwanger +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import { EventSubscription } from 'fbemitter'; +import { Component, ComponentClass, Ref, ComponentType } from 'react'; +import { + ColorPropType, + ImageRequireSource, + ImageURISource, + NativeEventEmitter, + ViewProperties, + ViewStyle, + Permission +} from 'react-native'; + +export type Axis = number; +export type BarCodeReadCallback = (params: { type: string; data: string; }) => void; +export type FloatFromZeroToOne = 0 | 0.1 | 0.2 | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 | 0.8 | 0.9 | 1; +export type Md5 = string; +export type Orientation = 'portrait' | 'landscape'; +export type RequireSource = ImageRequireSource; +export type ResizeModeContain = 'contain'; +export type ResizeModeCover = 'cover'; +export type ResizeModeStretch = 'stretch'; +export type URISource = ImageURISource; + +export interface HashMap { [key: string]: any; } + +/** Access the device accelerometer sensor(s) to respond to changes in acceleration in 3d space. */ +export namespace Accelerometer { + interface AccelerometerObject { + x: Axis; + y: Axis; + z: Axis; + } + + /** + * Subscribe for updates to the accelerometer. + * @param listener A callback that is invoked when an accelerometer update is available. When invoked, the listener is provided a single argumument that is an object containing keys x, y, z. + * @returns An EventSubscription object that you can call remove() on when you would like to unsubscribe the listener. + */ + function addListener(listener: (obj: AccelerometerObject) => any): EventSubscription; + + /** Remove all listeners. */ + function removeAllListeners(): void; + + /** + * Subscribe for updates to the accelerometer. + * @param intervalMs Desired interval in milliseconds between accelerometer updates. + */ + function setUpdateInterval(intervalMs: number): void; +} + +/** + * Provides access to Amplitude mobile analytics which basically lets you log various events to the Cloud. This module wraps Amplitude’s iOS and Android SDKs. + * + * Note: Session tracking may not work correctly when running Experiences in the main Expo app. It will work correctly if you create a standalone app. + */ +export namespace Amplitude { + /** Initializes Amplitude with your Amplitude API key. */ + function initialize(apiKey: string): void; + + /** Assign a user ID to the current user. If you don’t have a system for user IDs you don’t need to call this. */ + function setUserId(userId: string): void; + + /** Set properties for the current user. */ + function setUserProperties(userProperties: HashMap): void; + + /** Clear properties set by `setUserProperties()`. */ + function clearUserProperties(): void; + + /** Log an event to Amplitude. */ + function logEvent(eventName: string): void; + + /** Log an event to Amplitude with custom properties. */ + function logEventWithProperties( + eventName: string, + + /** A map of custom properties. */ + properties: HashMap + ): void; + + /** Add the current user to a group. */ + function setGroup( + /** The group name, e.g. `'sports'`. */ + groupType: string, + + /** An array of group names, e.g. `['tennis', 'soccer']`. */ + groupNames: string[] + ): void; +} + +// #region AppLoading +/** The following props are recommended, but optional for the sake of backwards compatibility (they were introduced in SDK21). If you do not provide any props, you are responsible for coordinating loading assets, handling errors, and updating state to unmount the `AppLoading` component. */ +export type AppLoadingProps = { + /** A `function` that returns a `Promise`. The `Promise` should resolve when the app is done loading data and assets. */ + startAsync: () => Promise; + + /** Required if you provide `startAsync`. Called when `startAsync` resolves or rejects. This should be used to set state and unmount the `AppLoading` component. */ + onFinish: () => void; + + /** If `startAsync` throws an error, it is caught and passed into the function provided to `onError`. */ + onError?: (error: Error) => void; +} | { + startAsync: null; + onFinish: null; + onError?: null; +}; + +/** + * A React component that tells Expo to keep the app loading screen open if it is the first and only component rendered in your app. When it is removed, the loading screen will disappear and your app will be visible. + * + * This is incredibly useful to let you download and cache fonts, logo and icon images and other assets that you want to be sure the user has on their device for an optimal experience before rendering they start using the app. + */ +export class AppLoading extends Component { } +// #endregion AppLoading + +/** This module provides an interface to Expo’s asset system. An asset is any file that lives alongside the source code of your app that the app needs at runtime. Examples include images, fonts and sounds. Expo’s asset system integrates with React Native’s, so that you can refer to files with require('path/to/file'). This is how you refer to static image files in React Native for use in an Image component, for example. */ +export class Asset { + constructor({ name, type, hash, uri, width, height }: { + name: string; + type: string; + hash: string; + uri: string; + width?: number; + height?: number; + }); + + /** The MD5 hash of the asset’s data. */ + hash: Md5; + + /** The name of the asset file without the extension. Also without the part from @ onward in the filename (used to specify scale factor for images). */ + name: string; + + /** The extension of the asset filename. */ + type: string; + + /** A URI that points to the asset’s data on the remote server. When running the published version of your app, this refers to the the location on Expo’s asset server where Expo has stored your asset. When running the app from XDE during development, this URI points to XDE’s server running on your computer and the asset is served directly from your computer. */ + uri: string; + + /** If the asset has been downloaded (by calling `downloadAsync()`), the `file://` URI pointing to the local file on the device that contains the asset data. */ + localUri: string; + + /** If the asset is an image, the width of the image data divided by the scale factor. The scale factor is the number after `@` in the filename, or `1` if not present. */ + width?: number; + + /** If the asset is an image, the height of the image data divided by the scale factor. The scale factor is the number after `@` in the filename, or `1` if not present. */ + height?: number; + + downloading: boolean; + downloaded: boolean; + downloadCallbacks: Array<{ resolve: () => any, reject: (e?: any) => any }>; + + /** Downloads the asset data to a local file in the device’s cache directory. Once the returned promise is fulfilled without error, the localUri field of this asset points to a local file containing the asset data. The asset is only downloaded if an up-to-date local file for the asset isn’t already present due to an earlier download. */ + downloadAsync(): Promise; + + /** Returns the `Expo.Asset` instance representing an asset given its module. */ + static fromModule(module: RequireSource): Asset; + + /** + * A helper that wraps `Expo.Asset.fromModule(module).downloadAsync` for convenience. + * @param moduleIds An array of `require('path/to/file')`. Can also be just one module without an Array. + */ + static loadAsync(module: RequireSource[] | RequireSource): Promise; +} + +/** + * Provides basic sample playback and recording. + * + * Note that Expo does not yet support backgrounding, so audio is not available to play in the background of your experience. Audio also automatically stops if headphones / bluetooth audio devices are disconnected. + */ +export namespace Audio { + enum InterruptionModeIos { + /** This is the default option. If this option is set, your experience’s audio is mixed with audio playing in background apps. */ + INTERRUPTION_MODE_IOS_MIX_WITH_OTHERS = 0, + + /** If this option is set, your experience’s audio interrupts audio from other apps. */ + INTERRUPTION_MODE_IOS_DO_NOT_MIX = 1, + + /** If this option is set, your experience’s audio lowers the volume ("ducks") of audio from other apps while your audio plays. */ + INTERRUPTION_MODE_IOS_DUCK_OTHERS = 2 + } + + const INTERRUPTION_MODE_IOS_MIX_WITH_OTHERS: 0; + const INTERRUPTION_MODE_IOS_DO_NOT_MIX: 1; + const INTERRUPTION_MODE_IOS_DUCK_OTHERS: 2; + + enum InterruptionModeAndroid { + /** If this option is set, your experience’s audio interrupts audio from other apps. */ + INTERRUPTION_MODE_ANDROID_DO_NOT_MIX = 1, + + /** This is the default option. If this option is set, your experience’s audio lowers the volume ("ducks") of audio from other apps while your audio plays. */ + INTERRUPTION_MODE_ANDROID_DUCK_OTHERS = 2 + } + + const INTERRUPTION_MODE_ANDROID_DO_NOT_MIX: 1; + const INTERRUPTION_MODE_ANDROID_DUCK_OTHERS: 2; + + const RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_DEFAULT: 0; + const RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_THREE_GPP: 1; + const RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_MPEG_4: 2; + const RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_AMR_NB: 3; + const RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_AMR_WB: 4; + const RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_AAC_ADIF: 5; + const RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_AAC_ADTS: 6; + const RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_RTP_AVP: 7; + const RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_MPEG2TS: 8; + const RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_WEBM: 9; + + const RECORDING_OPTION_ANDROID_AUDIO_ENCODER_DEFAULT: 0; + const RECORDING_OPTION_ANDROID_AUDIO_ENCODER_AMR_NB: 1; + const RECORDING_OPTION_ANDROID_AUDIO_ENCODER_AMR_WB: 2; + const RECORDING_OPTION_ANDROID_AUDIO_ENCODER_AAC: 3; + const RECORDING_OPTION_ANDROID_AUDIO_ENCODER_HE_AAC: 4; + const RECORDING_OPTION_ANDROID_AUDIO_ENCODER_AAC_ELD: 5; + const RECORDING_OPTION_ANDROID_AUDIO_ENCODER_VORBIS: 6; + + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_LINEARPCM: 'lpcm'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_AC3: 'ac-3'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_60958AC3: 'cac3'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_APPLEIMA4: 'ima4'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC: 'aac '; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4CELP: 'celp'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4HVXC: 'hvxc'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4TWINVQ: 'twvq'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MACE3: 'MAC3'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MACE6: 'MAC6'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_ULAW: 'ulaw'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_ALAW: 'alaw'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_QDESIGN: 'QDMC'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_QDESIGN2: 'QDM2'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_QUALCOMM: 'Qclp'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEGLAYER1: '.mp1'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEGLAYER2: '.mp2'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEGLAYER3: '.mp3'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_APPLELOSSLESS: 'alac'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_HE: 'aach'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_LD: 'aacl'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_ELD: 'aace'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_ELD_SBR: 'aacf'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_ELD_V2: 'aacg'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_HE_V2: 'aacp'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MPEG4AAC_SPATIAL: 'aacs'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_AMR: 'samr'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_AMR_WB: 'sawb'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_AUDIBLE: 'AUDB'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_ILBC: 'ilbc'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_DVIINTELIMA: 0x6d730011; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_MICROSOFTGSM: 0x6d730031; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_AES3: 'aes3'; + const RECORDING_OPTION_IOS_OUTPUT_FORMAT_ENHANCEDAC3: 'ec-3'; + + const RECORDING_OPTION_IOS_AUDIO_QUALITY_MIN: 0; + const RECORDING_OPTION_IOS_AUDIO_QUALITY_LOW: 0x20; + const RECORDING_OPTION_IOS_AUDIO_QUALITY_MEDIUM: 0x40; + const RECORDING_OPTION_IOS_AUDIO_QUALITY_HIGH: 0x60; + const RECORDING_OPTION_IOS_AUDIO_QUALITY_MAX: 0x7f; + + const RECORDING_OPTION_IOS_BIT_RATE_STRATEGY_CONSTANT: 0; + const RECORDING_OPTION_IOS_BIT_RATE_STRATEGY_LONG_TERM_AVERAGE: 1; + const RECORDING_OPTION_IOS_BIT_RATE_STRATEGY_VARIABLE_CONSTRAINED: 2; + const RECORDING_OPTION_IOS_BIT_RATE_STRATEGY_VARIABLE: 3; + + type RecordingStatus = { + canRecord: false, + isDoneRecording: false + } | { + canRecord: true, + isRecording: boolean, + durationMillis: number + } | { + canRecord: false, + isDoneRecording: true, + durationMillis: number + }; + + const RECORDING_OPTIONS_PRESET_HIGH_QUALITY: RecordingOptions; + const RECORDING_OPTIONS_PRESET_LOW_QUALITY: RecordingOptions; + + interface RecordingOptions { + android: { + extension: string; + outputFormat: number; + audioEncoder: number; + sampleRate?: number; + numberOfChannels?: number; + bitRate?: number; + maxFileSize?: number; + }; + ios: { + extension: string; + outputFormat?: string | number; + audioQuality: number; + sampleRate: number; + numberOfChannels: number; + bitRate: number; + bitRateStrategy?: number; + bitDepthHint?: number; + linearPCMBitDepth?: number; + linearPCMIsBigEndian?: boolean; + linearPCMIsFloat?: boolean; + }; + } + + interface AudioMode { + /** Boolean selecting if your experience’s audio should play in silent mode on iOS. This value defaults to `false`. */ + playsInSilentModeIOS: boolean; + + /** Boolean selecting if recording is enabled on iOS. This value defaults to `false`. NOTE: when this flag is set to true, playback may be routed to the phone receiver instead of to the speaker. */ + allowsRecordingIOS: boolean; + + /** Enum selecting how your experience’s audio should interact with the audio from other apps on iOS. */ + interruptionModeIOS: InterruptionModeIos; + + /** Boolean selecting if your experience’s audio should automatically be lowered in volume ("duck") if audio from another app interrupts your experience. This value defaults to true. If false, audio from other apps will pause your audio. */ + shouldDuckAndroid: boolean; + + /** an enum selecting how your experience’s audio should interact with the audio from other apps on Android: */ + interruptionModeAndroid: InterruptionModeAndroid; + } + + function setIsEnabledAsync(value: boolean): Promise; + function setAudioModeAsync(mode: AudioMode): Promise; + + /** This class represents a sound corresponding to an Asset or URL. */ + class Sound extends PlaybackObject { + constructor(); + + /** + * Creates and loads a sound from source, with optional `initialStatus`, `onPlaybackStatusUpdate`, and `downloadFirst`. + * + * @returns A `Promise` that is rejected if creation failed, or fulfilled with the following dictionary if creation succeeded: + * - `sound`: The newly created and loaded Sound object. + * - `status`: The PlaybackStatus of the Sound object. See the AV documentation for further information. + */ + static create( + /** + * The source of the sound. The following forms are supported: + * + * - A dictionary of the form `{ uri: 'http://path/to/file' }` with a network URL pointing to an audio file on the web. + * - `require('path/to/file')` for an audio file asset in the source code directory. + * - An `Expo.Asset` object for an audio file asset. + */ + source: PlaybackSource, + + /** The initial intended PlaybackStatusToSet of the sound, whose values will override the default initial playback status. This value defaults to `{}` if no parameter is passed. */ + initialStatus?: PlaybackStatusToSet, + + /** A function taking a single parameter PlaybackStatus. This value defaults to `null` if no parameter is passed. */ + onPlaybackStatusUpdate?: ((status: PlaybackStatus) => void) | null, + + /** If set to true, the system will attempt to download the resource to the device before loading. This value defaults to `true`. Note that at the moment, this will only work for `source`s of the form `require('path/to/file')` or `Asset` objects. */ + downloadFirst?: boolean + ): Promise<{ sound: Sound, status: PlaybackStatus }>; + } + + class Recording { + constructor(); + + /** Gets the `status` of the `Recording`. */ + getStatusAsync(): Promise; + + /** Sets a function to be called regularly with the `status` of the `Recording`. */ + setOnRecordingStatusUpdate(onRecordingStatusUpdate?: (status: RecordingStatus) => void): void; + + /** Sets the interval with which onRecordingStatusUpdate is called while the recording can record. This value defaults to 500 milliseconds. */ + setProgressUpdateInterval(progressUpdateIntervalMillis: number): void; + + /** Loads the recorder into memory and prepares it for recording. This must be called before calling `startAsync()`. This method can only be called if the `Recording` instance has never yet been prepared. */ + prepareToRecordAsync( + /** Options for the recording, including sample rate, bitrate, channels, format, encoder, and extension. If no options are passed to `prepareToRecordAsync()`, the recorder will be created with options `Expo.Audio.RECORDING_OPTIONS_PRESET_LOW_QUALITY`. */ + options?: RecordingOptions + ): Promise; + + /** Begins recording. This method can only be called if the `Recording` has been prepared. */ + startAsync(): Promise; + + /** + * Pauses recording. This method can only be called if the Recording has been prepared. + * + * NOTE: This is only available on Android API version 24 and later. + */ + pauseAsync(): Promise; + + /** Stops the recording and deallocates the recorder from memory. This reverts the Recording instance to an unprepared state, and another Recording instance must be created in order to record again. This method can only be called if the `Recording` has been prepared. */ + stopAndUnloadAsync(): Promise; + + /** + * Gets the local URI of the Recording. Note that this will only succeed once the Recording is prepared to record. + * + * @returns A string with the local URI of the `Recording`, or `null` if the `Recording` is not prepared to record. + */ + getURI(): string | null | undefined; + + /** + * Creates and loads a new `Sound` object to play back the `Recording`. Note that this will only succeed once the `Recording` is done recording (once `stopAndUnloadAsync()` has been called). + * + * @returns A Promise that is rejected if creation failed, or fulfilled with the following dictionary if creation succeeded: + * - `sound`: the newly created and loaded Sound object. + * - `status`: the PlaybackStatus of the Sound object. + */ + createNewLoadedSound( + /** The initial intended `PlaybackStatusToSet` of the sound, whose values will override the default initial playback status. This value defaults to `{}` if no parameter is passed. */ + initialStatus?: PlaybackStatusToSet, + + /** A function taking a single parameter `PlaybackStatus`. This value defaults to `null` if no parameter is passed. */ + onPlaybackStatusUpdate?: ((status: PlaybackStatus) => void) | null + ): Promise<{ sound: Sound, status: PlaybackStatus }>; + } +} + +/** + * AuthSession + */ +export namespace AuthSession { + type StartAsyncResponse = { + type: 'cancel'; + } | { + type: 'dismissed'; + } | { + type: 'success'; + params: HashMap; + event: HashMap; + } | { + type: 'error'; + params: HashMap; + errorCode: string; + event: HashMap; + }; + + function startAsync(options: { authUrl: string; returnUrl?: string; }): Promise; + function dismiss(): void; + function getRedirectUrl(): string; +} + +// #region AV +/** + * AV + */ +export type PlaybackStatus = { + isLoaded: false; + androidImplementation?: string; + + /** Populated exactly once when an error forces the object to unload. */ + error?: string; +} | { + isLoaded: true; + androidImplementation?: string; + uri: string; + progressUpdateIntervalMillis: number; + durationMillis?: number; + positionMillis: number; + playableDurationMillis?: number; + shouldPlay: boolean; + isPlaying: boolean; + isBuffering: boolean; + rate: number; + shouldCorrectPitch: boolean; + volume: number; + isMuted: boolean; + isLooping: boolean; + + /** True exactly once when the track plays to finish. */ + didJustFinish: boolean; +}; + +export interface PlaybackStatusToSet { + androidImplementation?: string; + progressUpdateIntervalMillis?: number; + positionMillis?: number; + shouldPlay?: boolean; + rate?: FloatFromZeroToOne; + shouldCorrectPitch?: boolean; + volume?: FloatFromZeroToOne; + isMuted?: boolean; + isLooping?: boolean; +} + +export type PlaybackSource = RequireSource | { uri: string } | Asset; + +export class PlaybackObject { + /** + * Gets the `PlaybackStatus` of the `playbackObject`. + * + * Returns a `Promise` that is fulfilled with the `PlaybackStatus` of the `playbackObject`. + */ + getStatusAsync(): Promise; + + /** + * Loads the media from source into memory and prepares it for playing. This must be called before calling setStatusAsync() or any of the convenience set status methods. This method can only be called if the playbackObject is in an unloaded state. + * + * Returns a `Promise` that is fulfilled with the `PlaybackStatus` of the `playbackObject` once it is loaded, or rejects if loading failed. The `Promise` will also reject if the `playbackObject` was already loaded. See below for details on `PlaybackStatus`. + */ + loadAsync( + /** + * The source of the media. The following forms are supported: + * - A dictionary of the form `{ uri: 'http://path/to/file' }` with a network URL pointing to a media file on the web. + * - `require('path/to/file')` for a media file asset in the source code directory. + * - An `Expo.Asset object` for a media file asset. + */ + source: PlaybackSource, + + /** The initial intended `PlaybackStatusToSet` of the `playbackObject`, whose values will override the default initial playback status. This value defaults to `{}` if no parameter is passed. See below for details on `PlaybackStatusToSet` and the default initial playback status. */ + initialStatus?: PlaybackStatusToSet, + + /** If set to `true`, the system will attempt to download the resource to the device before loading. This value defaults to true. Note that at the moment, this will only work for sources of the form `require('path/to/file')` or `Expo.Asset` objects. */ + downloadFirst?: boolean + ): Promise; + + /** This is equivalent to `playbackObject.setStatusAsync({ shouldPlay: false })`. */ + pauseAsync(): Promise; + + /** + * This is equivalent to `playbackObject.setStatusAsync({ shouldPlay: true })`. + * + * Playback may not start immediately after calling this function for reasons such as buffering. Make sure to update your UI based on the `isPlaying` and `isBuffering` properties of the `PlaybackStatus`. + */ + playAsync(): Promise; + + /** + * This is equivalent to `playbackObject.setStatusAsync({ shouldPlay: true, positionMillis: millis })`. + * + * Playback may not start immediately after calling this function for reasons such as buffering. Make sure to update your UI based on the isPlaying and `isBuffering` properties of the `PlaybackStatus`. + */ + playFromPositionAsync( + /** The desired position of playback in milliseconds. */ + positionMillis: number, + + /** This is equivalent to `playbackObject.setStatusAsync({ positionMillis: millis, seekMillisToleranceBefore: toleranceMillisBefore, seekMillisToleranceAfter: toleranceMillisAfter })`. The tolerances are used only on iOS. */ + tolerances?: { + toleranceMillisBefore: number, + toleranceMillisAfter: number + } + ): Promise; + + /** + * Replays the item. When using `playFromPositionAsync(0)` the item is seeked to the position at `0` ms. On iOS this method uses internal implementation of the player and is able to play the item from the beginning immediately. + * + * Returns a `Promise` that is fulfilled with the `PlaybackStatus` of the `playbackObject` once the new status has been set successfully, or rejects if setting the new status failed. + */ + replayAsync( + /** The new `PlaybackStatusToSet` of the `playbackObject`, whose values will override the current playback status. */ + status: PlaybackStatusToSet + ): Promise; + + /** This is equivalent to `playbackObject.setStatusAsync({ isLooping: value })`. */ + setIsLoopingAsync( + /** A boolean describing if the media should play once (`false`) or loop indefinitely (`true`). */ + isLooping: boolean + ): Promise; + + /** This is equivalent to `playbackObject.setStatusAsync({ isMuted: value })`. */ + setIsMutedAsync( + /** A boolean describing if the audio of this media should be muted. */ + isMuted: boolean + ): Promise; + + /** + * Sets a function to be called regularly with the `PlaybackStatus` of the `playbackObject`. See below for details on `PlaybackStatus` and an example use case of this function. + * + * `onPlaybackStatusUpdate` will be called whenever a call to the API for this `playbackObject` completes (such as `setStatusAsync()`, `getStatusAsync()`, or `unloadAsync()`), and will also be called at regular intervals while the media is in the loaded state. Set `progressUpdateIntervalMillis` via `setStatusAsync()` or `setProgressUpdateIntervalAsync()` to modify the interval with which `onPlaybackStatusUpdate` is called while loaded. + */ + setOnPlaybackStatusUpdate( + /** A function taking a single parameter `PlaybackStatus`. */ + onPlaybackStatusUpdate?: (status: PlaybackStatus) => void + ): void; + + /** This is equivalent to `playbackObject.setStatusAsync({ positionMillis: millis })`. */ + setPositionAsync( + positionMillis: number, + + /** This is equivalent to `playbackObject.setStatusAsync({ positionMillis: millis, seekMillisToleranceBefore: toleranceMillisBefore, seekMillisToleranceAfter: toleranceMillisAfter })`. The tolerances are used only on iOS. */ + tolerances?: { + toleranceMillisBefore: number, + toleranceMillisAfter: number + } + ): Promise; + + /** This is equivalent to `playbackObject.setStatusAsync({ progressUpdateIntervalMillis: millis })`. */ + setProgressUpdateIntervalAsync( + /** The new minimum interval in milliseconds between calls of `onPlaybackStatusUpdate`. */ + progressUpdateIntervalMillis: number + ): Promise; + + /** This is equivalent to `playbackObject.setStatusAsync({ rate: value, shouldCorrectPitch: shouldCorrectPitch })`. */ + setRateAsync( + /** The desired playback rate of the media. This value must be between `0.0` and `32.0`. Only available on Android API version 23 and later and iOS. */ + rate: number, + + /** A boolean describing if we should correct the pitch for a changed rate. If set to `true`, the pitch of the audio will be corrected (so a rate different than `1.0` will timestretch the audio). */ + shouldCorrectPitch: boolean + ): Promise; + + /** Sets a new `PlaybackStatusToSet` on the `playbackObject`. This method can only be called if the media has been loaded. Return a `Promise` that is fulfilled with the `PlaybackStatus` of the `playbackObject` once the new status has been set successfully, or rejects if setting the new status failed. */ + setStatusAsync( + /** The new `PlaybackStatusToSet` of the `playbackObject`, whose values will override the current playback status. */ + status: PlaybackStatusToSet + ): Promise; + + /** This is equivalent to `playbackObject.setStatusAsync({ volume: value })`. */ + setVolumeAsync( + /** A number between `0.0` (silence) and `1.0` (maximum volume). */ + volume: number + ): Promise; + + /** This is equivalent to `playbackObject.setStatusAsync({ shouldPlay: false, positionMillis: 0 })`. */ + stopAsync(): Promise; + + /** + * Unloads the media from memory. `loadAsync()` must be called again in order to be able to play the media. + * + * Returns a `Promise` that is fulfilled with the `PlaybackStatus` of the `playbackObject` once it is unloaded, or rejects if unloading failed. See below for details on `PlaybackStatus`. + */ + unloadAsync(): Promise; +} +// #endregion + +// #region BarCodeScanner +/** + * BarCodeScanner + */ +export interface BarCodeScannerProps extends ViewProperties { + type?: 'front' | 'back'; + torchMode?: 'on' | 'off'; + barCodeTypes?: string[]; + onBarCodeRead?: BarCodeReadCallback; +} + +export class BarCodeScanner extends Component { + static Constants: { + TorchMode: { + on: string; + off: string + } + } & CameraConstants; +} +// #endregion + +// #region BlurView +/** + * BlurView + */ +export interface BlurViewProps extends ViewProperties { + tint: 'light' | 'default' | 'dark'; + intensity: number; +} +export class BlurView extends Component { } +// #endregion + +/** + * Brightness + */ +export namespace Brightness { + function setBrightnessAsync(brightnessValue: FloatFromZeroToOne): Promise; + function getBrightnessAsync(): Promise; + function getSystemBrightnessAsync(): Promise; + function setSystemBrightnessAsync(brightnessValue: FloatFromZeroToOne): Promise; +} + +// #region Camera +/** + * Camera + */ +export interface PictureOptions { + quality?: number; +} + +export interface PictureResponse { + uri: string; + width: number; + height: number; + exif: string; + base64: string; +} + +export interface RecordingOptions { + quality?: string | number; + maxDuration?: number; + maxFileSize?: number; +} + +export class CameraObject { + takePictureAsync(options: PictureOptions): Promise; + recordAsync(options: RecordingOptions): Promise<{ uri: string; }>; + stopRecording(): void; + getSupportedRatiosAsync(): Promise; // Android only +} + +export interface CameraProps extends ViewProperties { + flashMode?: string | number; + type?: string | number; + ratio?: string; + autoFocus?: string | number | boolean; + focusDepth?: FloatFromZeroToOne; + zoom?: FloatFromZeroToOne; + whiteBalance?: string | number; + barCodeTypes?: string[]; + onCameraReady?: () => void; + onMountError?: () => void; + onBarCodeRead?: BarCodeReadCallback; + ref?: Ref; +} + +export interface CameraConstants { + readonly Type: string; + readonly FlashMode: string; + readonly AutoFocus: string; + readonly WhiteBalance: string; + readonly VideoQuality: string; + readonly BarCodeType: { + aztec: string; + codabar: string; + code39: string; + code93: string; + code128: string; + code138: string; + code39mod43: string; + datamatrix: string; + ean13: string; + ean8: string; + interleaved2of5: string; + itf14: string; + maxicode: string; + pdf417: string; + rss14: string; + rssexpanded: string; + upc_a: string; + upc_e: string; + upc_ean: string; + qr: string; + }; +} + +export class Camera extends Component { + static readonly Constants: CameraConstants; +} +// #endregion + +/** + * Constants + */ +export namespace Constants { + const appOwnership: 'expo' | 'standalone' | 'guest'; + const expoVersion: string; + const deviceId: string; + const deviceName: string; + const deviceYearClass: number; + const isDevice: boolean; + + interface Platform { + ios: { + platform: string; + model: string; + userInterfaceIdiom: string; + }; + } + const platform: Platform; + const sessionId: string; + const statusBarHeight: number; + const systemFonts: string[]; + + interface Manifest { + name: string; + description?: string; + slug?: string; + sdkVersion?: string; + version?: string; + orientation?: Orientation; + primaryColor?: string; + privacy?: 'public' | 'unlisted'; + scheme?: string; + icon?: string; + platforms?: string[]; + githubUrl?: string; + notification?: { + icon?: string, + color?: string, + androidMode?: 'default' | 'collapse', + androidCollapsedTitle?: string + }; + loading?: { + icon?: string, + exponentIconColor?: 'white' | 'blue', + exponentIconGrayscale?: 1 | 0, + backgroundImage?: string, + backgroundColor?: string, + hideExponentText?: boolean + }; + appKey?: string; + androidStatusBar?: { + barStyle?: 'lignt-content' | 'dark-content', + backgroundColor?: string + }; + androidShowExponentNotificationInShellApp?: boolean; + extra?: { + [propName: string]: any + }; + rnCliPath?: any; + entryPoint?: string; + packagerOpts?: { + hostType?: string, + dev?: boolean, + strict?: boolean, + minify?: boolean, + urlType?: string, + urlRandomness?: string, + lanType?: string, + [propName: string]: any + }; + ignoreNodeModulesValidation?: any; + nodeModulesPath?: string; + ios?: { + bundleIdentifier?: string, + buildNumber?: string, + config?: { + usesNonExemptEncryption?: boolean, + googleSignIn?: { + reservedClientId: string + } + }, + supportsTablet?: boolean, + infoPlist?: any + }; + android?: { + package?: string, + versionCode?: string, + config?: { + fabric?: { + apiKey: string, + buildSecret: string + }, + googleMaps?: { + apiKey: string + }, + googleSignIn?: { + apiKey: string, + certificateHash: string + } + } + }; + facebookScheme?: any; + facebookAppId?: string; + facebookDisplayName?: string; + splash?: { + backgroundColor?: string; + resizeMode?: ResizeModeContain | ResizeModeCover; + image?: string; + }; + assetBundlePatterns?: string[]; + releaseChannel: string; + [propName: string]: any; + } + const manifest: Manifest; + const linkingUri: string; +} + +/** + * Contacts + */ +export namespace Contacts { + type PhoneNumbers = 'phoneNumbers'; + type Emails = 'emails'; + type Addresses = 'addresses'; + type Image = 'image'; + type Thumbnail = 'thumbnail'; + type Note = 'note'; + type Birthday = 'birthday'; + type NonGregorianBirthday = 'nonGregorianBirthday'; + type NamePrefix = 'namePrefix'; + type NameSuffix = 'nameSuffix'; + type PhoneticFirstName = 'phoneticFirstName'; + type PhoneticMiddleName = 'phoneticMiddleName'; + type PhoneticLastName = 'phoneticLastName'; + type SocialProfiles = 'socialProfiles'; + type InstantMessageAddresses = 'instantMessageAddresses'; + type UrlAddresses = 'urlAddresses'; + type Dates = 'dates'; + type Relationships = 'relationships'; + + const PHONE_NUMBERS: PhoneNumbers; + const EMAILS: Emails; + const ADDRESSES: Addresses; + const IMAGE: Image; + const THUMBNAIL: Thumbnail; + const NOTE: Note; + const BIRTHDAY: Birthday; + const NON_GREGORIAN_BIRTHDAY: NonGregorianBirthday; + const NAME_PREFIX: NamePrefix; + const NAME_SUFFIX: NameSuffix; + const PHONETIC_FIRST_NAME: PhoneticFirstName; + const PHONETIC_MIDDLE_NAME: PhoneticMiddleName; + const PHONETIC_LAST_NAME: PhoneticLastName; + const SOCIAL_PROFILES: SocialProfiles; + const IM_ADDRESSES: InstantMessageAddresses; + const URLS: UrlAddresses; + const DATES: Dates; + const RELATIONSHIPS: Relationships; + + type FieldType = PhoneNumbers | Emails | Addresses | Image | Thumbnail | + Note | Birthday | NonGregorianBirthday | NamePrefix | NameSuffix | + PhoneticFirstName | PhoneticMiddleName | PhoneticLastName | SocialProfiles | + InstantMessageAddresses | UrlAddresses | Dates | Relationships; + + interface Options { + pageSize?: number; + pageOffset?: number; + fields?: FieldType[]; + } + + interface Contact { + id: string; + contactType: string; + name: string; + firstName?: string; + middleName?: string; + lastName?: string; + previousLastName?: string; + namePrefix?: string; + nameSuffix?: string; + nickname?: string; + phoneticFirstName?: string; + phoneticMiddleName?: string; + phoneticLastName?: string; + emails?: Array<{ + email?: string; + primary?: boolean; + label: string; + id: string; + }>; + phoneNumbers?: Array<{ + number?: string; + primary?: boolean; + digits?: string; + countryCode?: string; + label: string; + id: string; + }>; + addresses?: Array<{ + street?: string; + city?: string; + country?: string; + region?: string; + neighborhood?: string; + postalCode?: string; + poBox?: string; + isoCountryCode?: string; + label: string; + id: string; + }>; + socialProfiles?: Array<{ + service?: string; + localizedProfile?: string; + url?: string; + username?: string; + userId?: string; + label: string; + id: string; + }>; + instantMessageAddresses?: Array<{ + service?: string; + username?: string; + localizedService?: string; + label: string; + id: string; + }>; + urls?: { + label: string; + url?: string; + id: string; + }; + company?: string; + jobTitle?: string; + department?: string; + imageAvailable?: boolean; + image?: { + uri?: string; + }; + thumbnail?: { + uri?: string; + }; + note?: string; + dates?: Array<{ + day?: number; + month?: number; + year?: number; + id: string; + label: string; + }>; + relationships?: Array<{ + label: string; + name?: string; + id: string; + }>; + } + + interface Response { + data: Contact[]; + total: number; + hasNextPage: boolean; + hasPreviousPage: boolean; + } + + function getContactsAsync(options: Options): Promise; + function getContactByIdAsync(options: { id?: string; fields?: FieldType[] }): Promise; +} + +/** + * DocumentPicker + */ +export namespace DocumentPicker { + interface Options { + type?: string; + } + + type Response = { + type: 'success'; + uri: string; + name: string; + size: number; + } | { + type: 'cancel'; + }; + + function getDocumentAsync(options?: Options): Promise; +} + +/** + * ErrorRecovery + */ +export namespace ErrorRecovery { + function setRecoveryProps(props: HashMap): void; +} + +/** + * Facebook + */ +export namespace Facebook { + interface Options { + permissions?: string[]; + behavior?: 'web' | 'native' | 'browser' | 'system'; + } + interface Response { + type: 'cancel' | 'success'; + token?: string; + expires?: number; + } + function logInWithReadPermissionsAsync(appId: string, options?: Options): Promise; +} + +/** + * Facebook Ads + */ +export namespace FacebookAds { + /** + * Interstitial Ads + */ + namespace InterstitialAdManager { + function showAd(placementId: string): Promise; + } + + /** + * Native Ads + */ + type MediaCachePolicy = 'none' | 'icon' | 'image' | 'all'; + class NativeAdsManager { + constructor(placementId: string, numberOfAdsToRequest?: number); + disableAutoRefresh(): void; + setMediaCachePolicy(cachePolicy: MediaCachePolicy): void; + } + + function withNativeAd(component: Component<{ + icon?: string; + coverImage?: string; + title?: string; + subtitle?: string; + description?: string; + callToActionText?: string; + socialContext?: string; + }>): Component<{ adsManager: NativeAdsManager }, { ad: any, canRequestAds: boolean }>; + + /** + * Banner View + */ + type AdType = 'large' | 'rectangle' | 'standard'; + + interface BannerViewProps { + type: AdType; + placementId: string; + onPress: () => void; + onError: () => void; + } + + class BannerView extends Component { } + + /** + * Ad Settings + */ + namespace AdSettings { + const currentDeviceHash: string; + function addTestDevice(device: string): void; + function clearTestDevices(): void; + type SDKLogLevel = 'none' | 'debug' | 'verbose' | 'warning' | 'error' | 'notification'; + function setLogLevel(logLevel: SDKLogLevel): void; + function setIsChildDirected(isDirected: boolean): void; + function setMediationService(mediationService: string): void; + function setUrlPrefix(urlPrefix: string): void; + } +} + +/** + * FaceDetector + */ +export namespace FaceDetector { + interface Point { + x: Axis; + y: Axis; + } + interface FaceFeature { + bounds: { + size: { + width: number; + height: number; + }, + origin: Point; + }; + smilingProbability?: number; + leftEarPosition?: Point; + rightEarPosition?: Point; + leftEyePosition?: Point; + leftEyeOpenProbability?: number; + rightEyePosition?: Point; + rightEyeOpenProbability?: number; + leftCheekPosition?: Point; + rightCheekPosition?: Point; + leftMouthPosition?: Point; + mouthPosition?: Point; + rightMouthPosition?: Point; + bottomMouthPosition?: Point; + noseBasePosition?: Point; + yawAngle?: number; + rollAngle?: number; + } + interface DetectFaceResult { + faces: FaceFeature[]; + image: { + uri: string; + width: number; + height: number; + orientation: number; + }; + } + interface Mode { + fast: 'fast'; + accurate: 'accurate'; + } + interface _Shared { + all: 'all'; + none: 'none'; + } + type Landmarks = _Shared; + type Classifications = _Shared; + interface _Constants { + Mode: Mode; + Landmarks: Landmarks; + Classifications: Classifications; + } + + const Constants: _Constants; + + interface DetectionOptions { + mode?: keyof Mode; + detectLandmarks?: keyof Landmarks; + runClassifications?: keyof Classifications; + } + + function detectFaces(uri: string, options?: DetectionOptions): Promise; +} + +/** + * FileSystem + */ +export namespace FileSystem { + type FileInfo = { + exists: true; + isDirectory: boolean; + uri: string; + size: number; + modificationTime: number; + md5?: Md5; + } | { + exists: false; + isDirectory: false; + }; + + interface DownloadResult { + uri: string; + status: number; + headers: { [name: string]: string }; + md5?: Md5; + } + + const documentDirectory: string; + const cacheDirectory: string; + + function getInfoAsync(fileUri: string, options?: { md5?: string, size?: boolean; }): Promise; + function readAsStringAsync(fileUri: string): Promise; + function writeAsStringAsync(fileUri: string, contents: string): Promise; + function deleteAsync(fileUri: string, options?: { idempotent: boolean; }): Promise; + function moveAsync(options: { from: string, to: string; }): Promise; + function copyAsync(options: { from: string, to: string; }): Promise; + function makeDirectoryAsync(dirUri: string, options?: { intermediates: boolean }): Promise; + function readDirectoryAsync(dirUri: string): Promise; + function downloadAsync(uri: string, fileUri: string, options?: { md5?: boolean; }): Promise; + function createDownloadResumable( + uri: string, + fileUri: string, + options?: DownloadOptions, + callback?: (totalBytesWritten: number, totalBytesExpectedToWrite: number) => void, + resumeData?: string | null + ): DownloadResumable; + + interface PauseResult { + url: string; + fileUri: string; + options: { md5: boolean; }; + resumeData: string; + } + + interface DownloadOptions { + md5?: boolean; + headers?: { [name: string]: string }; + } + + interface DownloadProgressData { + totalBytesWritten: number; + totalBytesExpectedToWrite: number; + } + + type DownloadProgressCallback = (data: DownloadProgressData) => void; + + class DownloadResumable { + constructor( + url: string, + fileUri: string, + options: DownloadOptions, + callback?: DownloadProgressCallback, + resumeData?: string + ); + + downloadAsync(): Promise; + pauseAsync(): Promise; + resumeAsync(): Promise; + savable(): PauseResult; + } +} + +/** Use TouchID/FaceID (iOS) or the Fingerprint API (Android) to authenticate the user with a fingerprint scan. */ +export namespace Fingerprint { + type FingerprintAuthenticationResult = { + success: true + } | { + success: false, + + /** Error code in the case where authentication fails. */ + error: string + }; + + /** Determine whether the Fingerprint scanner is available on the device. */ + function hasHardwareAsync(): Promise; + + /** Determine whether the device has saved fingerprints to use for authentication. */ + function isEnrolledAsync(): Promise; + + /** + * Attempts to authenticate via Fingerprint. Android: When using the fingerprint module on Android, you need to provide a UI component to prompt the user to scan their fingerprint, as the OS has no default alert for it. + * + * @param promptMessage A message that is shown alongside the TouchID/FaceID prompt. (iOS only) + */ + function authenticateAsync(promptMessageIOS?: string): Promise; + + /** Cancels the fingerprint authentication flow. (Android only) */ + function cancelAuthenticate(): void; +} + +/** + * Font + */ +export namespace Font { + interface FontMap { + [name: string]: RequireSource; + } + + function loadAsync(name: string, url: string): Promise; + function loadAsync(map: FontMap): Promise; +} + +// #region GLView +/** + * GLView + */ +export interface GLViewProps extends ViewProperties { + onContextCreate(): void; + msaaSamples: number; +} + +export class GLView extends Component { } +// #endregion + +/** + * Google + */ +export namespace Google { + interface LogInConfig { + androidClientId?: string; + androidStandaloneAppClientId?: string; + iosClientId?: string; + iosStandaloneAppClientId?: string; + webClientId?: string; + behavior?: 'system' | 'web'; + scopes?: string[]; + } + + type LogInResult = { + type: 'cancel'; + } | { + type: 'success'; + accessToken: string; + idToken?: string; + refreshToken?: string; + serverAuthCode?: string; + user: { + id: string; + name: string; + givenName: string; + familyName: string; + photoUrl?: string; + email?: string; + } + }; + + function logInAsync(config: LogInConfig): Promise; +} + +/** Access the device gyroscope sensor to respond to changes in rotation in 3d space. */ +export namespace Gyroscope { + interface GyroscopeObject { + x: Axis; + y: Axis; + z: Axis; + } + + /** A callback that is invoked when an gyroscope update is available. */ + function addListener(listener: (obj: GyroscopeObject) => any): EventSubscription; + + /** Remove all listeners. */ + function removeAllListeners(): void; + + /** Subscribe for updates to the gyroscope. */ + function setUpdateInterval(intervalMs: number): void; +} + +/** + * ImageManipulator + */ +export namespace ImageManipulator { + interface ImageResult { + uri: string; + width: number; + height: number; + base64?: string; + } + + interface SaveOptions { + base64?: boolean; + compress?: FloatFromZeroToOne; + format?: 'jpeg' | 'png'; + } + + interface CropParameters { + originX: number; + originY: number; + width: number; + height: number; + } + + interface ImageManipulationOptions { + resize?: { width?: number; height?: number }; + rotate?: number; + flip?: { vertical?: boolean; horizontal?: boolean }; + crop?: CropParameters; + } + + function manipulate(uri: string, actions: ImageManipulationOptions, saveOptions?: SaveOptions): Promise; +} + +/** + * Image Picker + */ +export namespace ImagePicker { + interface ImageInfo { + uri: string; + width: number; + height: number; + } + + type ImageResult = { cancelled: true } | ({ cancelled: false } & ImageInfo); + + interface _MediaTypeOptions { + All: 'All'; + Videos: 'Videos'; + Images: 'Images'; + } + + const MediaTypeOptions: _MediaTypeOptions; + + interface ImageLibraryOptions { + allowsEditing?: boolean; + aspect?: [number, number]; + quality?: number; + mediaTypes?: keyof _MediaTypeOptions; + } + + function launchImageLibraryAsync(options?: ImageLibraryOptions): Promise; + + interface CameraOptions { + allowsEditing?: boolean; + aspect?: [number, number]; + quality?: number; + } + + function launchCameraAsync(options?: CameraOptions): Promise; +} + +/** + * IntentLauncherAndroid + */ +export namespace IntentLauncherAndroid { + const ACTION_ACCESSIBILITY_SETTINGS: 'android.settings.ACCESSIBILITY_SETTINGS'; + const ACTION_APP_NOTIFICATION_REDACTION: 'android.settings.ACTION_APP_NOTIFICATION_REDACTION'; + const ACTION_CONDITION_PROVIDER_SETTINGS: 'android.settings.ACTION_CONDITION_PROVIDER_SETTINGS'; + const ACTION_NOTIFICATION_LISTENER_SETTINGS: 'android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS'; + const ACTION_PRINT_SETTINGS: 'android.settings.ACTION_PRINT_SETTINGS'; + const ACTION_ADD_ACCOUNT_SETTINGS: 'android.settings.ADD_ACCOUNT_SETTINGS'; + const ACTION_AIRPLANE_MODE_SETTINGS: 'android.settings.AIRPLANE_MODE_SETTINGS'; + const ACTION_APN_SETTINGS: 'android.settings.APN_SETTINGS'; + const ACTION_APPLICATION_DETAILS_SETTINGS: 'android.settings.APPLICATION_DETAILS_SETTINGS'; + const ACTION_APPLICATION_DEVELOPMENT_SETTINGS: 'android.settings.APPLICATION_DEVELOPMENT_SETTINGS'; + const ACTION_APPLICATION_SETTINGS: 'android.settings.APPLICATION_SETTINGS'; + const ACTION_APP_NOTIFICATION_SETTINGS: 'android.settings.APP_NOTIFICATION_SETTINGS'; + const ACTION_APP_OPS_SETTINGS: 'android.settings.APP_OPS_SETTINGS'; + const ACTION_BATTERY_SAVER_SETTINGS: 'android.settings.BATTERY_SAVER_SETTINGS'; + const ACTION_BLUETOOTH_SETTINGS: 'android.settings.BLUETOOTH_SETTINGS'; + const ACTION_CAPTIONING_SETTINGS: 'android.settings.CAPTIONING_SETTINGS'; + const ACTION_CAST_SETTINGS: 'android.settings.CAST_SETTINGS'; + const ACTION_DATA_ROAMING_SETTINGS: 'android.settings.DATA_ROAMING_SETTINGS'; + const ACTION_DATE_SETTINGS: 'android.settings.DATE_SETTINGS'; + const ACTION_DEVICE_INFO_SETTINGS: 'android.settings.DEVICE_INFO_SETTINGS'; + const ACTION_DEVICE_NAME: 'android.settings.DEVICE_NAME'; + const ACTION_DISPLAY_SETTINGS: 'android.settings.DISPLAY_SETTINGS'; + const ACTION_DREAM_SETTINGS: 'android.settings.DREAM_SETTINGS'; + const ACTION_HARD_KEYBOARD_SETTINGS: 'android.settings.HARD_KEYBOARD_SETTINGS'; + const ACTION_HOME_SETTINGS: 'android.settings.HOME_SETTINGS'; + const ACTION_IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS: 'android.settings.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS'; + const ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS: 'android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS'; + const ACTION_INPUT_METHOD_SETTINGS: 'android.settings.INPUT_METHOD_SETTINGS'; + const ACTION_INPUT_METHOD_SUBTYPE_SETTINGS: 'android.settings.INPUT_METHOD_SUBTYPE_SETTINGS'; + const ACTION_INTERNAL_STORAGE_SETTINGS: 'android.settings.INTERNAL_STORAGE_SETTINGS'; + const ACTION_LOCALE_SETTINGS: 'android.settings.LOCALE_SETTINGS'; + const ACTION_LOCATION_SOURCE_SETTINGS: 'android.settings.LOCATION_SOURCE_SETTINGS'; + const ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS: 'android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS'; + const ACTION_MANAGE_APPLICATIONS_SETTINGS: 'android.settings.MANAGE_APPLICATIONS_SETTINGS'; + const ACTION_MANAGE_DEFAULT_APPS_SETTINGS: 'android.settings.MANAGE_DEFAULT_APPS_SETTINGS'; + const ACTION_MEMORY_CARD_SETTINGS: 'android.settings.MEMORY_CARD_SETTINGS'; + const ACTION_MONITORING_CERT_INFO: 'android.settings.MONITORING_CERT_INFO'; + const ACTION_NETWORK_OPERATOR_SETTINGS: 'android.settings.NETWORK_OPERATOR_SETTINGS'; + const ACTION_NFCSHARING_SETTINGS: 'android.settings.NFCSHARING_SETTINGS'; + const ACTION_NFC_PAYMENT_SETTINGS: 'android.settings.NFC_PAYMENT_SETTINGS'; + const ACTION_NFC_SETTINGS: 'android.settings.NFC_SETTINGS'; + const ACTION_NIGHT_DISPLAY_SETTINGS: 'android.settings.NIGHT_DISPLAY_SETTINGS'; + const ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS: 'android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS'; + const ACTION_NOTIFICATION_SETTINGS: 'android.settings.NOTIFICATION_SETTINGS'; + const ACTION_PAIRING_SETTINGS: 'android.settings.PAIRING_SETTINGS'; + const ACTION_PRIVACY_SETTINGS: 'android.settings.PRIVACY_SETTINGS'; + const ACTION_QUICK_LAUNCH_SETTINGS: 'android.settings.QUICK_LAUNCH_SETTINGS'; + const ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS: 'android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS'; + const ACTION_SECURITY_SETTINGS: 'android.settings.SECURITY_SETTINGS'; + const ACTION_SETTINGS: 'android.settings.SETTINGS'; + const ACTION_SHOW_ADMIN_SUPPORT_DETAILS: 'android.settings.SHOW_ADMIN_SUPPORT_DETAILS'; + const ACTION_SHOW_INPUT_METHOD_PICKER: 'android.settings.SHOW_INPUT_METHOD_PICKER'; + const ACTION_SHOW_REGULATORY_INFO: 'android.settings.SHOW_REGULATORY_INFO'; + const ACTION_SHOW_REMOTE_BUGREPORT_DIALOG: 'android.settings.SHOW_REMOTE_BUGREPORT_DIALOG'; + const ACTION_SOUND_SETTINGS: 'android.settings.SOUND_SETTINGS'; + const ACTION_STORAGE_MANAGER_SETTINGS: 'android.settings.STORAGE_MANAGER_SETTINGS'; + const ACTION_SYNC_SETTINGS: 'android.settings.SYNC_SETTINGS'; + const ACTION_SYSTEM_UPDATE_SETTINGS: 'android.settings.SYSTEM_UPDATE_SETTINGS'; + const ACTION_TETHER_PROVISIONING_UI: 'android.settings.TETHER_PROVISIONING_UI'; + const ACTION_TRUSTED_CREDENTIALS_USER: 'android.settings.TRUSTED_CREDENTIALS_USER'; + const ACTION_USAGE_ACCESS_SETTINGS: 'android.settings.USAGE_ACCESS_SETTINGS'; + const ACTION_USER_DICTIONARY_INSERT: 'android.settings.USER_DICTIONARY_INSERT'; + const ACTION_USER_DICTIONARY_SETTINGS: 'android.settings.USER_DICTIONARY_SETTINGS'; + const ACTION_USER_SETTINGS: 'android.settings.USER_SETTINGS'; + const ACTION_VOICE_CONTROL_AIRPLANE_MODE: 'android.settings.VOICE_CONTROL_AIRPLANE_MODE'; + const ACTION_VOICE_CONTROL_BATTERY_SAVER_MODE: 'android.settings.VOICE_CONTROL_BATTERY_SAVER_MODE'; + const ACTION_VOICE_CONTROL_DO_NOT_DISTURB_MODE: 'android.settings.VOICE_CONTROL_DO_NOT_DISTURB_MODE'; + const ACTION_VOICE_INPUT_SETTINGS: 'android.settings.VOICE_INPUT_SETTINGS'; + const ACTION_VPN_SETTINGS: 'android.settings.VPN_SETTINGS'; + const ACTION_VR_LISTENER_SETTINGS: 'android.settings.VR_LISTENER_SETTINGS'; + const ACTION_WEBVIEW_SETTINGS: 'android.settings.WEBVIEW_SETTINGS'; + const ACTION_WIFI_IP_SETTINGS: 'android.settings.WIFI_IP_SETTINGS'; + const ACTION_WIFI_SETTINGS: 'android.settings.WIFI_SETTINGS'; + const ACTION_WIRELESS_SETTINGS: 'android.settings.WIRELESS_SETTINGS'; + const ACTION_ZEN_MODE_AUTOMATION_SETTINGS: 'android.settings.ZEN_MODE_AUTOMATION_SETTINGS'; + const ACTION_ZEN_MODE_EVENT_RULE_SETTINGS: 'android.settings.ZEN_MODE_EVENT_RULE_SETTINGS'; + const ACTION_ZEN_MODE_EXTERNAL_RULE_SETTINGS: 'android.settings.ZEN_MODE_EXTERNAL_RULE_SETTINGS'; + const ACTION_ZEN_MODE_PRIORITY_SETTINGS: 'android.settings.ZEN_MODE_PRIORITY_SETTINGS'; + const ACTION_ZEN_MODE_SCHEDULE_RULE_SETTINGS: 'android.settings.ZEN_MODE_SCHEDULE_RULE_SETTINGS'; + const ACTION_ZEN_MODE_SETTINGS: 'android.settings.ZEN_MODE_SETTINGS'; + + function startActivityAsync(activity: string, data?: HashMap): Promise; +} + +/** + * KeepAwake + */ +export class KeepAwake extends Component { + static activate(): void; + static deactivate(): void; +} + +// #region LinearGradient +/** + * LinearGradient + */ +export interface LinearGradientProps extends ViewProperties { + colors: string[]; + start?: [number, number]; + end?: [number, number]; + locations?: number[]; +} + +export class LinearGradient extends Component { } +// #endregion + +/** + * Location + */ +export namespace Location { + interface LocationOptions { + enableHighAccuracy?: boolean; + timeInterval?: number; + distanceInterval?: number; + } + + interface LocationProps { + latitude: number; + longitude: number; + } + + interface Coords extends LocationProps { + altitude: number; + accuracy: number; + } + + interface LocationData { + coords: { + heading: number; + speed: number + } & Coords; + timestamp: number; + } + + interface ProviderStatus { + locationServicesEnabled: boolean; + gpsAvailable?: boolean; + networkAvailable?: boolean; + passiveAvailable?: boolean; + } + + interface HeadingStatus { + magHeading: number; + trueHeading: number; + accuracy: number; + } + + interface GeocodeData { + city: string; + street: string; + region: string; + postalCode: string; + country: string; + name: string; + } + + type LocationCallback = (data: LocationData) => void; + + function getCurrentPositionAsync(options: LocationOptions): Promise; + function watchPositionAsync(options: LocationOptions, callback: LocationCallback): EventSubscription; + function getProviderStatusAsync(): Promise; + function getHeadingAsync(): Promise; + function watchHeadingAsync(callback: (status: HeadingStatus) => void): EventSubscription; + function geocodeAsync(address: string): Promise; + function reverseGeocodeAsync(location: LocationProps): Promise; + function setApiKey(key: string): void; +} + +/** + * Magnetometer + */ +export namespace Magnetometer { + interface MagnetometerObject { + x: Axis; + y: Axis; + z: Axis; + } + + function addListener(listener: (obj: MagnetometerObject) => any): EventSubscription; + function removeAllListeners(): void; + function setUpdateInterval(intervalMs: number): void; +} + +/** + * Notifications + */ +export namespace Notifications { + interface Notification { + origin: 'selected' | 'received'; + data: any; + remote: boolean; + isMultiple: boolean; + } + + interface LocalNotification { + title: string; + body?: string; + data?: any; + ios?: { + sound?: boolean + }; + android?: { + sound?: boolean; + icon?: string; + color?: string; + priority?: 'min' | 'low' | 'high' | 'max'; + sticky?: boolean; + vibrate?: boolean | number[]; + link?: string; + }; + } + + type LocalNotificationId = string | number; + + function addListener(listener: (notification: Notification) => any): EventSubscription; + function getExpoPushTokenAsync(): Promise; + function presentLocalNotificationAsync(localNotification: LocalNotification): Promise; + function scheduleLocalNotificationAsync( + localNotification: LocalNotification, + schedulingOptions: { time: Date | number, repeat?: 'minute' | 'hour' | 'day' | 'week' | 'month' | 'year' } + ): Promise; + function dismissNotificationAsync(localNotificationId: LocalNotificationId): Promise; + function dismissAllNotificationsAsync(): Promise; + function cancelScheduledNotificationAsync(localNotificationId: LocalNotificationId): Promise; + function cancelAllScheduledNotificationsAsync(): Promise; + function getBadgeNumberAsync(): Promise; + function setBadgeNumberAsync(number: number): Promise; +} + +/** + * Pedometer + */ +export namespace Pedometer { + function isAvailableAsync(): Promise; + function getStepCountAsync(start: Date, end: Date): Promise<{ steps: number; }>; + function watchStepCount(callback: (params: { steps: number; }) => void): EventSubscription; +} + +/** + * Permissions + */ +export namespace Permissions { + type PermissionType = 'remoteNotifications' | 'location' | + 'camera' | 'contacts' | 'audioRecording'; + type PermissionStatus = 'undetermined' | 'granted' | 'denied'; + type PermissionExpires = 'never'; + + interface PermissionDetailsLocationIOS { + scope: 'whenInUse' | 'always'; + } + + interface PermissionDetailsLocationAndroid { + scope: 'fine' | 'coarse' | 'none'; + } + + interface PermissionResponse { + status: PermissionStatus; + expires: PermissionExpires; + ios?: PermissionDetailsLocationIOS; + android?: PermissionDetailsLocationAndroid; + } + + function getAsync(type: PermissionType): Promise; + function askAsync(type: PermissionType): Promise; + + type RemoteNotificationPermission = 'remoteNotifications'; + + const CAMERA: 'camera'; + const CAMERA_ROLL: 'cameraRoll'; + const AUDIO_RECORDING: 'audioRecording'; + const LOCATION: 'location'; + const REMOTE_NOTIFICATIONS: RemoteNotificationPermission; + const NOTIFICATIONS: RemoteNotificationPermission; + const CONTACTS: 'contacts'; + const SYSTEM_BRIGHTNESS: 'systemBrightness'; +} + +/** + * Register Root Component + */ +export function registerRootComponent(component: ComponentType): void; + +/** + * ScreenOrientation + */ +export namespace ScreenOrientation { + interface Orientations { + ALL: 'ALL'; + ALL_BUT_UPSIDE_DOWN: 'ALL_BUT_UPSIDE_DOWN'; + PORTRAIT: 'PORTRAIT'; + PORTRAIT_UP: 'PORTRAIT_UP'; + PORTRAIT_DOWN: 'PORTRAIT_DOWN'; + LANDSCAPE: 'LANDSCAPE'; + LANDSCAPE_LEFT: 'LANDSCAPE_LEFT'; + LANDSCAPE_RIGHT: 'LANDSCAPE_RIGHT'; + } + + const Orientation: Orientations; + + function allow(orientation: keyof Orientations): void; +} + +/** + * SecureStore + */ +export namespace SecureStore { + interface SecureStoreOptions { + keychainService?: string; + keychainAccessible?: number; + } + + function setItemAsync(key: string, value: string, options?: SecureStoreOptions): Promise; + function getItemAsync(key: string, options?: SecureStoreOptions): Promise; + function deleteItemAsync(key: string, options?: SecureStoreOptions): Promise; +} + +/** + * Segment + */ +export namespace Segment { + function initialize(keys: { + androidWriteKey: string; + iosWriteKey: string; + }): void; + function identify(userId: string): void; + function identifyWithTraits(userId: string, traits: object): void; + function track(event: string): void; + function reset(): void; + function trackWithProperties(event: string, properties: object): void; + function screen(screenName: string): void; + function screenWithProperties(screenName: string, properties: object): void; + function flush(): void; +} + +/** + * Speech + */ +export namespace Speech { + interface SpeechOptions { + language?: string; + pitch?: number; + rate?: number; + onStart?: () => void; + onStopped?: () => void; + onDone?: () => void; + onError?: (error: string) => void; + } + + function speak(text: string, options?: SpeechOptions): void; + function stop(): void; + function isSpeakingAsync(): Promise; +} + +/** + * SQLite + */ +export namespace SQLite { + type Error = any; + + interface Database { + transaction( + callback: (transaction: Transaction) => any, + error?: (error: Error) => any, // TODO def of error + success?: () => any + ): void; + } + + interface Transaction { + executeSql( + sqlStatement: string, + arguments?: string[] | number[], + success?: (transaction: Transaction, resultSet: ResultSet) => any, + error?: (transaction: Transaction, error: Error) => any + ): void; + } + + interface ResultSet { + insertId: number; + rowAffected: number; + rows: { + length: number; + item: (index: number) => any; + _array: HashMap[]; + }; + } + + function openDatabase( + name: string | { + name: string, + version?: string, + description?: string, + size?: number, + callback?: () => any + }, + version?: string, + description?: string, + size?: number, + callback?: () => any + ): any; +} + +// #region Svg +/** + * Svg + */ +export interface SvgCommonProps { + fill?: string; + fillOpacity?: number | string; + stroke?: string; + strokeWidth?: number | string; + strokeOpacity?: number | string; + strokeLinecap?: string; + strokeLineJoin?: string; + strokeDasharray?: any[]; + strokeDashoffset?: any; + x?: number | string; + y?: number | string; + rotate?: number | string; + scale?: number | string; + origin?: number | string; + originX?: number | string; + originY?: number | string; + id?: string; + disabled?: boolean; + onPress?: () => any; + onPressIn?: () => any; + onPressOut?: () => any; + onLongPress?: () => any; + delayPressIn?: number; + delayPressOut?: number; + delayLongPress?: number; +} + +export interface SvgRectProps extends SvgCommonProps { + width: number | string; + height: number | string; +} + +export interface SvgCircleProps extends SvgCommonProps { + cx: number | string; + cy: number | string; + r: number | string; +} + +export interface SvgEllipseProps extends SvgCommonProps { + cx: number | string; + cy: number | string; + rx: number | string; + ry: number | string; +} + +export interface SvgLineProps extends SvgCommonProps { + x1: number | string; + y1: number | string; + x2: number | string; + y2: number | string; +} + +export interface SvgPolyProps extends SvgCommonProps { + points: string; +} + +export interface SvgPathProps extends SvgCommonProps { + d: string; +} + +export interface SvgTextProps extends SvgCommonProps { + textAnchor?: string; + fontSize?: number | string; + fontWeight?: string; +} + +export interface SvgTSpanProps extends SvgTextProps { + dx?: string; + dy?: string; +} + +export interface SvgTextPathProps extends SvgCommonProps { + href?: string; + startOffset?: string; +} + +export interface SvgUseProps extends SvgCommonProps { + href: string; + x: number | string; + y: number | string; +} + +export interface SvgSymbolProps extends SvgCommonProps { + viewBox: string; + width: number | string; + height: number | string; +} + +export interface SvgLinearGradientProps extends SvgCommonProps { + x1: number | string; + x2: number | string; + y1: number | string; + y2: number | string; +} + +export interface SvgRadialGradientProps extends SvgCommonProps { + cx: number | string; + cy: number | string; + rx: number | string; + ry: number | string; + fx: number | string; + fy: number | string; + gradientUnits?: string; +} + +export interface SvgStopProps extends SvgCommonProps { + offset?: string; + stopColor?: string; + stopOpacity?: string; +} + +export class Svg extends Component<{ width: number, height: number }> { + static Circle: ComponentClass; + static ClipPath: ComponentClass; + static Defs: ComponentClass; + static Ellipse: ComponentClass; + static G: ComponentClass; + static Line: ComponentClass; + static LinearGradient: ComponentClass; + static Path: ComponentClass; + static Polygon: ComponentClass; + static Polyline: ComponentClass; + static RadialGradient: ComponentClass; + static Rect: ComponentClass; + static Stop: ComponentClass; + static Symbol: ComponentClass; + static Text: ComponentClass; + static TextPath: ComponentClass; + static TSpan: ComponentClass; + static Use: ComponentClass; +} +// #endregion + +/** + * Take Snapshot + */ +export function takeSnapshotAsync( + view?: (number | React.ReactElement), + options?: { + width?: number, + height?: number, + format?: 'png' | 'jpg' | 'jpeg' | 'webm', + quality?: number, + result?: 'file' | 'base64' | 'data-uri', + } +): Promise; + +/** Helpful utility functions that don’t fit anywhere else, including some localization and internationalization methods. */ +export namespace Util { + /** Returns the current device country code. */ + function getCurrentDeviceCountryAsync(): Promise; + + /** Returns the current device locale as a string. */ + function getCurrentLocaleAsync(): Promise; + + /** Returns the current device time zone name. */ + function getCurrentTimeZoneAsync(): Promise; + + /** Reloads the current experience. This will fetch and load the newest available JavaScript supported by the device’s Expo environment. This is useful for triggering an update of your experience if you have published a new version. */ + function reload(): void; + + /** _Android only_. Invokes a callback when a new version of your app is successfully downloaded in the background. */ + function addNewVersionListenerExperimental(listener: (event: { + manifest: object; + }) => void): { remove(): void; }; +} + +// #region Video +/** + * Expo Video + */ +export interface NaturalSize { + width: number; + height: number; + orientation: Orientation; +} + +export interface ReadyForDisplayEvent { + naturalSize: NaturalSize; + status: PlaybackStatus; +} + +export enum FullscreenUpdateVariants { + IOS_FULLSCREEN_UPDATE_PLAYER_WILL_PRESENT = 0, + IOS_FULLSCREEN_UPDATE_PLAYER_DID_PRESENT = 1, + IOS_FULLSCREEN_UPDATE_PLAYER_WILL_DISMISS = 2, + IOS_FULLSCREEN_UPDATE_PLAYER_DID_DISMISS = 3 +} + +export interface FullscreenUpdateEvent { + fullscreenUpdate: FullscreenUpdateVariants; + status: PlaybackStatus; +} + +export interface VideoProps { + source?: PlaybackSource | null; + posterSource?: URISource | RequireSource; + + resizeMode?: ResizeModeContain | ResizeModeCover | ResizeModeStretch; + useNativeControls?: boolean; + usePoster?: boolean; + + onPlaybackStatusUpdate?: (status: PlaybackStatus) => void; + onReadyForDisplay?: (event: ReadyForDisplayEvent) => void; + onIOSFullscreenUpdate?: (event: FullscreenUpdateEvent) => void; + + onLoadStart?: () => void; + onLoad?: (status: PlaybackStatus) => void; + onError?: (error: string) => void; + + status?: PlaybackStatusToSet; + progressUpdateIntervalMillis?: number; + positionMillis?: number; + shouldPlay?: boolean; + rate?: number; + shouldCorrectPitch?: boolean; + volume?: number; + isMuted?: boolean; + isLooping?: boolean; + + scaleX?: number; + scaleY?: number; + translateX?: number; + translateY?: number; + rotation?: number; + ref?: Ref; +} + +export interface VideoState { + showPoster: boolean; +} + +export class Video extends Component { + static RESIZE_MODE_CONTAIN: ResizeModeContain; + static RESIZE_MODE_COVER: ResizeModeCover; + static RESIZE_MODE_STRETCH: ResizeModeStretch; + static IOS_FULLSCREEN_UPDATE_PLAYER_WILL_PRESENT: FullscreenUpdateVariants.IOS_FULLSCREEN_UPDATE_PLAYER_WILL_PRESENT; + static IOS_FULLSCREEN_UPDATE_PLAYER_DID_PRESENT: FullscreenUpdateVariants.IOS_FULLSCREEN_UPDATE_PLAYER_DID_PRESENT; + static IOS_FULLSCREEN_UPDATE_PLAYER_WILL_DISMISS: FullscreenUpdateVariants.IOS_FULLSCREEN_UPDATE_PLAYER_WILL_DISMISS; + static IOS_FULLSCREEN_UPDATE_PLAYER_DID_DISMISS: FullscreenUpdateVariants.IOS_FULLSCREEN_UPDATE_PLAYER_DID_DISMISS; +} +// #endregion + +/** + * Web Browser + */ +export namespace WebBrowser { + function openBrowserAsync(url: string): Promise<{ type: 'cancelled' | 'dismissed' }>; + function openAuthSessionAsync(url: string, redirectUrl?: string): Promise<{ type: 'cancelled' | 'dismissed' }>; + function dismissBrowser(): Promise<{ type: 'dismissed' }>; +} diff --git a/types/expo/v24/tsconfig.json b/types/expo/v24/tsconfig.json new file mode 100644 index 0000000000..87b7b33224 --- /dev/null +++ b/types/expo/v24/tsconfig.json @@ -0,0 +1,32 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "jsx": "react", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "expo": [ + "expo/v24" + ], + "expo/*": [ + "expo/v24/*" + ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "expo-tests.tsx" + ] +} \ No newline at end of file diff --git a/types/expo/v24/tslint.json b/types/expo/v24/tslint.json new file mode 100644 index 0000000000..8270136207 --- /dev/null +++ b/types/expo/v24/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "void-return": false, + "max-line-length": false + } +} diff --git a/types/feathersjs__feathers/index.d.ts b/types/feathersjs__feathers/index.d.ts index c10a173f06..6ae7b22238 100644 --- a/types/feathersjs__feathers/index.d.ts +++ b/types/feathersjs__feathers/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Jan Lohage , Abraao Alves // Definitions: https://github.com/feathersjs-ecosystem/feathers-typescript -// TypeScript Version: 2.2 +// TypeScript Version: 2.3 /// @@ -30,7 +30,7 @@ export type ServerSideParams = Params; export interface Params { query?: Query; - paginate: false | Pick; + paginate?: false | Pick; [key: string]: any; // (JL) not sure if we want this } @@ -42,10 +42,11 @@ export interface Paginated { data: T[]; } -export type Hook = (hook: HookContext) => (Promise> | undefined); +// tslint:disable-next-line void-return +export type Hook = (hook: HookContext) => (Promise> | void); export interface HookContext { - app?: Application; + app?: Application; data?: T; error?: any; id?: string | number; @@ -89,7 +90,7 @@ export interface ServiceMethods { } export interface SetupMethod { - setup(app: Application, path: string): void; + setup(app: Application, path: string): void; } export interface ServiceOverloads { @@ -106,7 +107,7 @@ export interface ServiceAddons extends EventEmitter { export type Service = ServiceOverloads & ServiceAddons & ServiceMethods; -export interface Application extends EventEmitter { +export interface Application extends EventEmitter { get(name: string): any; set(name: string, value: any): this; @@ -129,7 +130,7 @@ export interface Application extends EventEmitter { service(location: string): Service; - use(path: string, service: Partial & SetupMethod> | Application, options?: any): this; + use(path: string, service: Partial & SetupMethod> | Application, options?: any): this; version: string; } diff --git a/types/feathersjs__socket-commons/index.d.ts b/types/feathersjs__socket-commons/index.d.ts index fca658bf76..043009fd5e 100644 --- a/types/feathersjs__socket-commons/index.d.ts +++ b/types/feathersjs__socket-commons/index.d.ts @@ -28,8 +28,10 @@ declare module '@feathersjs/feathers' { interface Application { channel(...names: string[]): Channel; - publish(callback: (data: T, hook: HookContext) => Channel | Channel[]): Application; + // tslint:disable-next-line void-return + publish(callback: (data: T, hook: HookContext) => Channel | Channel[] | void): Application; - publish(event: string, callback: (data: T, hook: HookContext) => Channel | Channel[]): Application; + // tslint:disable-next-line void-return + publish(event: string, callback: (data: T, hook: HookContext) => Channel | Channel[] | void): Application; } } diff --git a/types/feathersjs__socketio/index.d.ts b/types/feathersjs__socketio/index.d.ts index 34b78eb749..7ba889dfbe 100644 --- a/types/feathersjs__socketio/index.d.ts +++ b/types/feathersjs__socketio/index.d.ts @@ -7,6 +7,6 @@ /// /// -export default function feathersSocketIO(callback: (io: SocketIO.Server) => void): () => void; +export default function feathersSocketIO(callback?: (io: SocketIO.Server) => void): () => void; export default function feathersSocketIO(options: number | SocketIO.ServerOptions, callback?: (io: SocketIO.Server) => void): () => void; export default function feathersSocketIO(port: number, options?: SocketIO.ServerOptions, callback?: (io: SocketIO.Server) => void): () => void; diff --git a/types/fingerprintjs2/index.d.ts b/types/fingerprintjs2/index.d.ts index 94b705b807..5778eebeed 100644 --- a/types/fingerprintjs2/index.d.ts +++ b/types/fingerprintjs2/index.d.ts @@ -41,3 +41,6 @@ interface Fingerprint2Options { excludePixelRatio?: boolean; excludeHardwareConcurrency?: boolean; } + +export = Fingerprint2; +export as namespace Fingerprint2; diff --git a/types/forever-agent/forever-agent-tests.ts b/types/forever-agent/forever-agent-tests.ts new file mode 100644 index 0000000000..b1ba9965fc --- /dev/null +++ b/types/forever-agent/forever-agent-tests.ts @@ -0,0 +1,37 @@ +import ForeverAgent = require("forever-agent"); + +const agent = new ForeverAgent(); +const agentSsl = new ForeverAgent.SSL(); + +const agentWithBaseOptions = new ForeverAgent({ + keepAlive: true, + keepAliveMsecs: 100, + maxFreeSockets: 500, + maxSockets: 100, +}); + +const agentSslWithBaseOptions = new ForeverAgent({ + keepAlive: true, + keepAliveMsecs: 100, + maxFreeSockets: 500, + maxSockets: 100, +}); + +const agentWithAllOptions = new ForeverAgent({ + keepAlive: true, + keepAliveMsecs: 100, + maxFreeSockets: 500, + maxSockets: 100, + minSockets: 500, +}); + +const agentSslWithAllOptions = new ForeverAgent({ + keepAlive: true, + keepAliveMsecs: 100, + maxFreeSockets: 500, + maxSockets: 100, + minSockets: 500, +}); + +const agentDefaultMinSockets = ForeverAgent.defaultMinSockets; +const agentSslDefaultMinSockets = ForeverAgent.SSL.defaultMinSockets; diff --git a/types/forever-agent/index.d.ts b/types/forever-agent/index.d.ts new file mode 100644 index 0000000000..1126a2a1c4 --- /dev/null +++ b/types/forever-agent/index.d.ts @@ -0,0 +1,28 @@ +// Type definitions for forever-agent 0.6 +// Project: https://github.com/mikeal/forever-agent +// Definitions by: Dmitry Guketlev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import { Agent as HttpAgent, AgentOptions as HttpAgentOptions } from "http"; + +export = ForeverAgentModule; + +interface ForeverAgentOptions extends HttpAgentOptions { + minSockets?: number; +} + +declare class ForeverAgent extends HttpAgent { + constructor(options?: ForeverAgentOptions); + + static defaultMinSockets: number; +} + +declare class ForeverAgentSSL extends ForeverAgent { + constructor(options?: ForeverAgentOptions); +} + +declare const ForeverAgentModule: typeof ForeverAgent & { + SSL: typeof ForeverAgentSSL, +}; diff --git a/types/forever-agent/tsconfig.json b/types/forever-agent/tsconfig.json new file mode 100644 index 0000000000..4868c35d0c --- /dev/null +++ b/types/forever-agent/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", + "forever-agent-tests.ts" + ] +} diff --git a/types/forever-agent/tslint.json b/types/forever-agent/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/forever-agent/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/fs-extra/index.d.ts b/types/fs-extra/index.d.ts index f556afa82f..6183dce393 100644 --- a/types/fs-extra/index.d.ts +++ b/types/fs-extra/index.d.ts @@ -290,6 +290,7 @@ export interface WriteOptions extends WriteFileOptions { fs?: object; replacer?: any; spaces?: number | string; + EOL?: string; } export interface ReadResult { diff --git a/types/fs-extra/v4/index.d.ts b/types/fs-extra/v4/index.d.ts index 575df86b4d..e5180a7a94 100644 --- a/types/fs-extra/v4/index.d.ts +++ b/types/fs-extra/v4/index.d.ts @@ -290,6 +290,7 @@ export interface WriteOptions extends WriteFileOptions { fs?: object; replacer?: any; spaces?: number | string; + EOL?: string; } export interface ReadResult { diff --git a/types/google-apps-script/google-apps-script.slides.d.ts b/types/google-apps-script/google-apps-script.slides.d.ts new file mode 100644 index 0000000000..494663f002 --- /dev/null +++ b/types/google-apps-script/google-apps-script.slides.d.ts @@ -0,0 +1,1423 @@ +// Type definitions for Google Apps Script 2018-02-14 +// Project: https://developers.google.com/apps-script/ +// Definitions by: motemen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// +/// + +declare namespace GoogleAppsScript { + export module Slides { + /** + * A 3x3 matrix used to transform source coordinates (x1, y1) into destination coordinates (x2, y2) + * according to matrix multiplication: + * + * [ x2 ] [ scaleX shearX translateX ] [ x1 ] + * [ y2 ] = [ shearY scaleY translateY ] [ y1 ] + * [ 1 ] [ 0 0 1 ] [ 1 ] + * + * After transformation, + * + * x2 = scaleX * x1 + shearX * y1 + translateX + * y2 = scaleY * y1 + shearY * x1 + translateY + */ + export interface AffineTransform { + getScaleX(): Number; + getScaleY(): Number; + getShearX(): Number; + getShearY(): Number; + getTranslateX(): Number; + getTranslateY(): Number; + toBuilder(): AffineTransformBuilder; + } + + /** + * A builder for AffineTransform objects. Defaults to the identity transform. + * + * Call AffineTransformBuilder#build() to get the AffineTransform object. + * + * var transform = + * SlidesApp.newAffineTransformBuilder().setScaleX(2.0).setShearY(1.1).build(); + * + * The resulting transform matrix is + * [ 2.0 0.0 0.0 ] + * [ 1.1 1.0 0.0 ] + * [ 0 0 1 ] + */ + export interface AffineTransformBuilder { + build(): AffineTransform; + setScaleX(scaleX: Number): AffineTransformBuilder; + setScaleY(scaleY: Number): AffineTransformBuilder; + setShearX(shearX: Number): AffineTransformBuilder; + setShearY(shearY: Number): AffineTransformBuilder; + setTranslateX(translateX: Number): AffineTransformBuilder; + setTranslateY(translateY: Number): AffineTransformBuilder; + } + + /** + * The alignment position to apply. + */ + export enum AlignmentPosition { CENTER, HORIZONTAL_CENTER, VERTICAL_CENTER } + + /** + * The kinds of start and end forms with which linear geometry can be rendered. + * + * Some values are based on the "ST_LineEndType" simple type described in section 20.1.10.33 of + * of "Office Open XML File Formats - Fundamentals and Markup Language Reference", part 1 of ECMA-376 4th + * edition. + */ + export enum ArrowStyle { UNSUPPORTED, NONE, STEALTH_ARROW, FILL_ARROW, FILL_CIRCLE, FILL_SQUARE, FILL_DIAMOND, OPEN_ARROW, OPEN_CIRCLE, OPEN_SQUARE, OPEN_DIAMOND } + + /** + * An element of text that is dynamically replaced with content that can change over time, such as a + * slide number. + */ + export interface AutoText { + getAutoTextType(): AutoTextType; + getIndex(): Integer; + getRange(): TextRange; + } + + /** + * The types of auto text. + */ + export enum AutoTextType { UNSUPPORTED, SLIDE_NUMBER } + + /** + * Describes the border around an element. + */ + export interface Border { + getDashStyle(): DashStyle; + getLineFill(): LineFill; + getWeight(): Number; + isVisible(): boolean; + setDashStyle(style: DashStyle): Border; + setTransparent(): Border; + setWeight(points: Number): Border; + } + + /** + * The table cell merge states. + */ + export enum CellMergeState { NORMAL, HEAD, MERGED } + + /** + * An opaque color + */ + export interface Color { + asRgbColor(): RgbColor; + asThemeColor(): ThemeColor; + getColorType(): ColorType; + } + + /** + * A color scheme defines a mapping from members of ThemeColorType to the actual colors used + * to render them. + */ + export interface ColorScheme { + getConcreteColor(theme: ThemeColorType): Color; + getThemeColors(): ThemeColorType[]; + } + + /** + * The types of Colors + */ + export enum ColorType { UNSUPPORTED, RGB, THEME } + + /** + * The content alignments for a Shape or TableCell. The supported alignments + * correspond to predefined text anchoring types from the ECMA-376 standard. + * + * More information on those alignments can be found in the description of + * the ST_TextAnchoringType simple type in section 20.1.10.59 of "Office Open XML File + * Formats - Fundamentals and Markup Language Reference", part 1 of ECMA-376 4th + * edition. + */ + export enum ContentAlignment { UNSUPPORTED, TOP, MIDDLE, BOTTOM } + + /** + * The kinds of dashes with which linear geometry can be rendered. These values are based on the + * "ST_PresetLineDashVal" simple type described in section 20.1.10.48 of "Office Open XML File + * Formats - Fundamentals and Markup Language Reference", part 1 of ECMA-376 4th + * edition. + */ + export enum DashStyle { UNSUPPORTED, SOLID, DOT, DASH, DASH_DOT, LONG_DASH, LONG_DASH_DOT } + + /** + * Describes the page element's background + */ + export interface Fill { + getSolidFill(): SolidFill; + getType(): FillType; + isVisible(): boolean; + setSolidFill(color: Color): void; + setSolidFill(color: Color, alpha: Number): void; + setSolidFill(red: Integer, green: Integer, blue: Integer): void; + setSolidFill(red: Integer, green: Integer, blue: Integer, alpha: Number): void; + setSolidFill(hexString: string): void; + setSolidFill(hexString: string, alpha: Number): void; + setSolidFill(color: ThemeColorType): void; + setSolidFill(color: ThemeColorType, alpha: Number): void; + setTransparent(): void; + } + + /** + * The kinds of fill. + */ + export enum FillType { UNSUPPORTED, NONE, SOLID } + + /** + * A collection of PageElements joined as a single unit. + */ + export interface Group { + alignOnPage(alignmentPosition: AlignmentPosition): Group; + duplicate(): PageElement; + getChildren(): PageElement[]; + getDescription(): string; + getHeight(): Number; + getInherentHeight(): Number; + getInherentWidth(): Number; + getLeft(): Number; + getObjectId(): string; + getPageElementType(): PageElementType; + getParentGroup(): Group; + getParentPage(): Page; + getRotation(): Number; + getTitle(): string; + getTop(): Number; + getTransform(): AffineTransform; + getWidth(): Number; + preconcatenateTransform(transform: AffineTransform): Group; + remove(): void; + scaleHeight(ratio: Number): Group; + scaleWidth(ratio: Number): Group; + select(): void; + select(replace: boolean): void; + setHeight(height: Number): Group; + setLeft(left: Number): Group; + setRotation(angle: Number): Group; + setTop(top: Number): Group; + setTransform(transform: AffineTransform): Group; + setWidth(width: Number): Group; + ungroup(): void; + } + + /** + * A PageElement representing an image. + */ + export interface Image { + alignOnPage(alignmentPosition: AlignmentPosition): Image; + duplicate(): PageElement; + getBorder(): Border; + getContentUrl(): string; + getDescription(): string; + getHeight(): Number; + getInherentHeight(): Number; + getInherentWidth(): Number; + getLeft(): Number; + getLink(): Link; + getObjectId(): string; + getPageElementType(): PageElementType; + getParentGroup(): Group; + getParentPage(): Page; + getRotation(): Number; + getSourceUrl(): string; + getTitle(): string; + getTop(): Number; + getTransform(): AffineTransform; + getWidth(): Number; + preconcatenateTransform(transform: AffineTransform): Image; + remove(): void; + removeLink(): void; + replace(blobSource: Base.BlobSource): Image; + replace(blobSource: Base.BlobSource, crop: boolean): Image; + replace(imageUrl: string): Image; + replace(imageUrl: string, crop: boolean): Image; + scaleHeight(ratio: Number): Image; + scaleWidth(ratio: Number): Image; + select(): void; + select(replace: boolean): void; + setHeight(height: Number): Image; + setLeft(left: Number): Image; + setLinkSlide(slideIndex: Integer): Link; + setLinkSlide(slide: Slide): Link; + setLinkSlide(slidePosition: SlidePosition): Link; + setLinkUrl(url: string): Link; + setRotation(angle: Number): Image; + setTop(top: Number): Image; + setTransform(transform: AffineTransform): Image; + setWidth(width: Number): Image; + } + + /** + * A layout in a presentation. + * + * Each layout serves as a template for slides that inherit from it, determining how content on + * those slides is arranged and styled. + */ + export interface Layout { + getBackground(): PageBackground; + getColorScheme(): ColorScheme; + getGroups(): Group[]; + getImages(): Image[]; + getLayoutName(): string; + getLines(): Line[]; + getMaster(): Master; + getObjectId(): string; + getPageElements(): PageElement[]; + getPageType(): PageType; + getPlaceholder(placeholderType: PlaceholderType): PageElement; + getPlaceholder(placeholderType: PlaceholderType, placeholderIndex: Integer): PageElement; + getPlaceholders(): PageElement[]; + getShapes(): Shape[]; + getSheetsCharts(): SheetsChart[]; + getTables(): Table[]; + getVideos(): Video[]; + getWordArts(): WordArt[]; + group(pageElements: PageElement[]): Group; + insertGroup(group: Group): Group; + insertImage(blobSource: Base.BlobSource): Image; + insertImage(blobSource: Base.BlobSource, left: Number, top: Number, width: Number, height: Number): Image; + insertImage(image: Image): Image; + insertImage(imageUrl: string): Image; + insertImage(imageUrl: string, left: Number, top: Number, width: Number, height: Number): Image; + insertLine(line: Line): Line; + insertLine(lineCategory: LineCategory, startLeft: Number, startTop: Number, endLeft: Number, endTop: Number): Line; + insertPageElement(pageElement: PageElement): PageElement; + insertShape(shape: Shape): Shape; + insertShape(shapeType: ShapeType): Shape; + insertShape(shapeType: ShapeType, left: Number, top: Number, width: Number, height: Number): Shape; + insertSheetsChart(sourceChart: Spreadsheet.EmbeddedChart): SheetsChart; + insertSheetsChart(sourceChart: Spreadsheet.EmbeddedChart, left: Number, top: Number, width: Number, height: Number): SheetsChart; + insertSheetsChart(sheetsChart: SheetsChart): SheetsChart; + insertSheetsChartAsImage(sourceChart: Spreadsheet.EmbeddedChart): Image; + insertSheetsChartAsImage(sourceChart: Spreadsheet.EmbeddedChart, left: Number, top: Number, width: Number, height: Number): Image; + insertTable(numRows: Integer, numColumns: Integer): Table; + insertTable(numRows: Integer, numColumns: Integer, left: Number, top: Number, width: Number, height: Number): Table; + insertTable(table: Table): Table; + insertVideo(videoUrl: string): Video; + insertVideo(videoUrl: string, left: Number, top: Number, width: Number, height: Number): Video; + insertVideo(video: Video): Video; + insertWordArt(wordArt: WordArt): WordArt; + remove(): void; + replaceAllText(findText: string, replaceText: string): Integer; + replaceAllText(findText: string, replaceText: string, matchCase: boolean): Integer; + selectAsCurrentPage(): void; + } + + /** + * A PageElement representing a line. + */ + export interface Line { + alignOnPage(alignmentPosition: AlignmentPosition): Line; + duplicate(): PageElement; + getDashStyle(): DashStyle; + getDescription(): string; + getEnd(): Point; + getEndArrow(): ArrowStyle; + getHeight(): Number; + getInherentHeight(): Number; + getInherentWidth(): Number; + getLeft(): Number; + getLineFill(): LineFill; + getLineType(): LineType; + getLink(): Link; + getObjectId(): string; + getPageElementType(): PageElementType; + getParentGroup(): Group; + getParentPage(): Page; + getRotation(): Number; + getStart(): Point; + getStartArrow(): ArrowStyle; + getTitle(): string; + getTop(): Number; + getTransform(): AffineTransform; + getWeight(): Number; + getWidth(): Number; + preconcatenateTransform(transform: AffineTransform): Line; + remove(): void; + removeLink(): void; + scaleHeight(ratio: Number): Line; + scaleWidth(ratio: Number): Line; + select(): void; + select(replace: boolean): void; + setDashStyle(style: DashStyle): Line; + setEnd(left: Number, top: Number): Line; + setEnd(point: Point): Line; + setEndArrow(style: ArrowStyle): Line; + setHeight(height: Number): Line; + setLeft(left: Number): Line; + setLinkSlide(slideIndex: Integer): Link; + setLinkSlide(slide: Slide): Link; + setLinkSlide(slidePosition: SlidePosition): Link; + setLinkUrl(url: string): Link; + setRotation(angle: Number): Line; + setStart(left: Number, top: Number): Line; + setStart(point: Point): Line; + setStartArrow(style: ArrowStyle): Line; + setTop(top: Number): Line; + setTransform(transform: AffineTransform): Line; + setWeight(points: Number): Line; + setWidth(width: Number): Line; + } + + /** + * The line category. + * + * The exact LineType created is determined based on the category and how it's routed to + * connect to other page elements. + */ + export enum LineCategory { STRAIGHT, BENT, CURVED } + + /** + * Describes the fill of a line or outline + */ + export interface LineFill { + getFillType(): LineFillType; + getSolidFill(): SolidFill; + setSolidFill(color: Color): void; + setSolidFill(color: Color, alpha: Number): void; + setSolidFill(red: Integer, green: Integer, blue: Integer): void; + setSolidFill(red: Integer, green: Integer, blue: Integer, alpha: Number): void; + setSolidFill(hexString: string): void; + setSolidFill(hexString: string, alpha: Number): void; + setSolidFill(color: ThemeColorType): void; + setSolidFill(color: ThemeColorType, alpha: Number): void; + } + + /** + * The kinds of line fill. + */ + export enum LineFillType { UNSUPPORTED, NONE, SOLID } + + /** + * The line types. + * + * Derived from a subset of the values of the "ST_ShapeType" simple type in section 20.1.10.55 of + * "Office Open XML File Formats - Fundamentals and Markup Language Reference", part 1 of ECMA-376 4th + * edition. + */ + export enum LineType { UNSUPPORTED, STRAIGHT_CONNECTOR_1, BENT_CONNECTOR_2, BENT_CONNECTOR_3, BENT_CONNECTOR_4, BENT_CONNECTOR_5, CURVED_CONNECTOR_2, CURVED_CONNECTOR_3, CURVED_CONNECTOR_4, CURVED_CONNECTOR_5 } + + /** + * A hypertext link. + */ + export interface Link { + getLinkType(): LinkType; + getLinkedSlide(): Slide; + getSlideId(): string; + getSlideIndex(): Integer; + getSlidePosition(): SlidePosition; + getUrl(): string; + } + + /** + * The types of a Link. + */ + export enum LinkType { UNSUPPORTED, URL, SLIDE_POSITION, SLIDE_ID, SLIDE_INDEX } + + /** + * A list in the text. + */ + export interface List { + getListId(): string; + getListParagraphs(): Paragraph[]; + } + + /** + * Preset patterns of glyphs for lists in text. + * + * These presets use these glyphs: + * + * ARROW: An arrow, ➔, corresponding to a Unicode U+2794 code point + * + * ARROW3D: An arrow with 3D shading, ➢, corresponding to a Unicode U+27a2 code point + * + * CHECKBOX: A hollow square, ❏, corresponding to a Unicode U+274f code point + * + * CIRCLE: A hollow circle, ○, corresponding to a Unicode U+25cb code point + * + * DIAMOND: A solid diamond, ◆, corresponding to a Unicode U+25c6 code point + * + * `DIAMONDX: A diamond with an 'x', ❖, corresponding to a Unicode U+2756 code point + * + * HOLLOWDIAMOND: A hollow diamond, ◇, corresponding to a Unicode U+25c7 code point + * + * DISC: A solid circle, ●, corresponding to a Unicode U+25cf code point + * + * SQUARE: A solid square, ■, corresponding to a Unicode U+25a0 code point + * + * STAR: A star, ★, corresponding to a Unicode U+2605 code point + * + * ALPHA: A lowercase letter, like 'a', 'b', or 'c'. + * + * UPPERALPHA: An uppercase letter, like 'A', 'B', or 'C'. + * + * DIGIT: A number, like '1', '2', or '3'. + * + * ZERODIGIT: A number where single digit numbers are prefixed with a zero, like '01', '02', + * or '03'. Numbers with more than one digit are not prefixed a zero. + * + * ROMAN: A lowercase roman numeral, like 'i', 'ii', or 'iii'. + * + * UPPERROMAN: A uppercase roman numeral, like 'I', 'II', or 'III'. + * + * LEFTTRIANGLE: A triangle pointing left, ◄, corresponding to a Unicode U+25c4 code + * point + */ + export enum ListPreset { DISC_CIRCLE_SQUARE, DIAMONDX_ARROW3D_SQUARE, CHECKBOX, ARROW_DIAMOND_DISC, STAR_CIRCLE_SQUARE, ARROW3D_CIRCLE_SQUARE, LEFTTRIANGLE_DIAMOND_DISC, DIAMONDX_HOLLOWDIAMOND_SQUARE, DIAMOND_CIRCLE_SQUARE, DIGIT_ALPHA_ROMAN, DIGIT_ALPHA_ROMAN_PARENS, DIGIT_NESTED, UPPERALPHA_ALPHA_ROMAN, UPPERROMAN_UPPERALPHA_DIGIT, ZERODIGIT_ALPHA_ROMAN } + + /** + * The list styling for a range of text. + */ + export interface ListStyle { + applyListPreset(listPreset: ListPreset): ListStyle; + getGlyph(): string; + getList(): List; + getNestingLevel(): Integer; + isInList(): boolean; + removeFromList(): ListStyle; + } + + /** + * A master in a presentation. + * + * Masters contains all common page elements and the common properties for a set of layouts. They + * serve three purposes: + * + * Placeholder shapes on a master contain the default text styles and shape properties of all + * placeholder shapes on pages that use that master. + * + * The properties of a master page define the common page properties inherited by its layouts. + * + * Any other shapes on the master slide appear on all slides using that master, regardless of + * their layout. + */ + export interface Master { + getBackground(): PageBackground; + getColorScheme(): ColorScheme; + getGroups(): Group[]; + getImages(): Image[]; + getLayouts(): Layout[]; + getLines(): Line[]; + getObjectId(): string; + getPageElements(): PageElement[]; + getPageType(): PageType; + getPlaceholder(placeholderType: PlaceholderType): PageElement; + getPlaceholder(placeholderType: PlaceholderType, placeholderIndex: Integer): PageElement; + getPlaceholders(): PageElement[]; + getShapes(): Shape[]; + getSheetsCharts(): SheetsChart[]; + getTables(): Table[]; + getVideos(): Video[]; + getWordArts(): WordArt[]; + group(pageElements: PageElement[]): Group; + insertGroup(group: Group): Group; + insertImage(blobSource: Base.BlobSource): Image; + insertImage(blobSource: Base.BlobSource, left: Number, top: Number, width: Number, height: Number): Image; + insertImage(image: Image): Image; + insertImage(imageUrl: string): Image; + insertImage(imageUrl: string, left: Number, top: Number, width: Number, height: Number): Image; + insertLine(line: Line): Line; + insertLine(lineCategory: LineCategory, startLeft: Number, startTop: Number, endLeft: Number, endTop: Number): Line; + insertPageElement(pageElement: PageElement): PageElement; + insertShape(shape: Shape): Shape; + insertShape(shapeType: ShapeType): Shape; + insertShape(shapeType: ShapeType, left: Number, top: Number, width: Number, height: Number): Shape; + insertSheetsChart(sourceChart: Spreadsheet.EmbeddedChart): SheetsChart; + insertSheetsChart(sourceChart: Spreadsheet.EmbeddedChart, left: Number, top: Number, width: Number, height: Number): SheetsChart; + insertSheetsChart(sheetsChart: SheetsChart): SheetsChart; + insertSheetsChartAsImage(sourceChart: Spreadsheet.EmbeddedChart): Image; + insertSheetsChartAsImage(sourceChart: Spreadsheet.EmbeddedChart, left: Number, top: Number, width: Number, height: Number): Image; + insertTable(numRows: Integer, numColumns: Integer): Table; + insertTable(numRows: Integer, numColumns: Integer, left: Number, top: Number, width: Number, height: Number): Table; + insertTable(table: Table): Table; + insertVideo(videoUrl: string): Video; + insertVideo(videoUrl: string, left: Number, top: Number, width: Number, height: Number): Video; + insertVideo(video: Video): Video; + insertWordArt(wordArt: WordArt): WordArt; + remove(): void; + replaceAllText(findText: string, replaceText: string): Integer; + replaceAllText(findText: string, replaceText: string, matchCase: boolean): Integer; + selectAsCurrentPage(): void; + } + + /** + * A notes master in a presentation. + * + * Notes masters define the default text styles and page elements for all notes pages. Notes + * masters are read-only. + */ + export interface NotesMaster { + getGroups(): Group[]; + getImages(): Image[]; + getLines(): Line[]; + getObjectId(): string; + getPageElements(): PageElement[]; + getPlaceholder(placeholderType: PlaceholderType): PageElement; + getPlaceholder(placeholderType: PlaceholderType, placeholderIndex: Integer): PageElement; + getPlaceholders(): PageElement[]; + getShapes(): Shape[]; + getSheetsCharts(): SheetsChart[]; + getTables(): Table[]; + getVideos(): Video[]; + getWordArts(): WordArt[]; + } + + /** + * A notes page in a presentation. + * + * These pages contain the content for presentation handouts, including a a shape that contains + * the slide's speaker notes. Each slide has one corresponding notes page. Only the text in the + * speaker notes shape can be modified. + */ + export interface NotesPage { + getGroups(): Group[]; + getImages(): Image[]; + getLines(): Line[]; + getObjectId(): string; + getPageElements(): PageElement[]; + getPlaceholder(placeholderType: PlaceholderType): PageElement; + getPlaceholder(placeholderType: PlaceholderType, placeholderIndex: Integer): PageElement; + getPlaceholders(): PageElement[]; + getShapes(): Shape[]; + getSheetsCharts(): SheetsChart[]; + getSpeakerNotesShape(): Shape; + getTables(): Table[]; + getVideos(): Video[]; + getWordArts(): WordArt[]; + replaceAllText(findText: string, replaceText: string): Integer; + replaceAllText(findText: string, replaceText: string, matchCase: boolean): Integer; + } + + /** + * A page in a presentation. + */ + export interface Page { + asLayout(): Layout; + asMaster(): Master; + asSlide(): Slide; + getBackground(): PageBackground; + getColorScheme(): ColorScheme; + getGroups(): Group[]; + getImages(): Image[]; + getLines(): Line[]; + getObjectId(): string; + getPageElements(): PageElement[]; + getPageType(): PageType; + getPlaceholder(placeholderType: PlaceholderType): PageElement; + getPlaceholder(placeholderType: PlaceholderType, placeholderIndex: Integer): PageElement; + getPlaceholders(): PageElement[]; + getShapes(): Shape[]; + getSheetsCharts(): SheetsChart[]; + getTables(): Table[]; + getVideos(): Video[]; + getWordArts(): WordArt[]; + group(pageElements: PageElement[]): Group; + insertGroup(group: Group): Group; + insertImage(blobSource: Base.BlobSource): Image; + insertImage(blobSource: Base.BlobSource, left: Number, top: Number, width: Number, height: Number): Image; + insertImage(image: Image): Image; + insertImage(imageUrl: string): Image; + insertImage(imageUrl: string, left: Number, top: Number, width: Number, height: Number): Image; + insertLine(line: Line): Line; + insertLine(lineCategory: LineCategory, startLeft: Number, startTop: Number, endLeft: Number, endTop: Number): Line; + insertPageElement(pageElement: PageElement): PageElement; + insertShape(shape: Shape): Shape; + insertShape(shapeType: ShapeType): Shape; + insertShape(shapeType: ShapeType, left: Number, top: Number, width: Number, height: Number): Shape; + insertSheetsChart(sourceChart: Spreadsheet.EmbeddedChart): SheetsChart; + insertSheetsChart(sourceChart: Spreadsheet.EmbeddedChart, left: Number, top: Number, width: Number, height: Number): SheetsChart; + insertSheetsChart(sheetsChart: SheetsChart): SheetsChart; + insertSheetsChartAsImage(sourceChart: Spreadsheet.EmbeddedChart): Image; + insertSheetsChartAsImage(sourceChart: Spreadsheet.EmbeddedChart, left: Number, top: Number, width: Number, height: Number): Image; + insertTable(numRows: Integer, numColumns: Integer): Table; + insertTable(numRows: Integer, numColumns: Integer, left: Number, top: Number, width: Number, height: Number): Table; + insertTable(table: Table): Table; + insertVideo(videoUrl: string): Video; + insertVideo(videoUrl: string, left: Number, top: Number, width: Number, height: Number): Video; + insertVideo(video: Video): Video; + insertWordArt(wordArt: WordArt): WordArt; + remove(): void; + replaceAllText(findText: string, replaceText: string): Integer; + replaceAllText(findText: string, replaceText: string, matchCase: boolean): Integer; + selectAsCurrentPage(): void; + } + + /** + * Describes the page's background + */ + export interface PageBackground { + getPictureFill(): PictureFill; + getSolidFill(): SolidFill; + getType(): PageBackgroundType; + isVisible(): boolean; + setPictureFill(blobSource: Base.BlobSource): void; + setPictureFill(imageUrl: string): void; + setSolidFill(color: Color): void; + setSolidFill(color: Color, alpha: Number): void; + setSolidFill(red: Integer, green: Integer, blue: Integer): void; + setSolidFill(red: Integer, green: Integer, blue: Integer, alpha: Number): void; + setSolidFill(hexString: string): void; + setSolidFill(hexString: string, alpha: Number): void; + setSolidFill(color: ThemeColorType): void; + setSolidFill(color: ThemeColorType, alpha: Number): void; + setTransparent(): void; + } + + /** + * The kinds of page backgrounds. + */ + export enum PageBackgroundType { UNSUPPORTED, NONE, SOLID, PICTURE } + + /** + * A visual element rendered on a page. + */ + export interface PageElement { + alignOnPage(alignmentPosition: AlignmentPosition): PageElement; + asGroup(): Group; + asImage(): Image; + asLine(): Line; + asShape(): Shape; + asSheetsChart(): SheetsChart; + asTable(): Table; + asVideo(): Video; + asWordArt(): WordArt; + duplicate(): PageElement; + getDescription(): string; + getHeight(): Number; + getInherentHeight(): Number; + getInherentWidth(): Number; + getLeft(): Number; + getObjectId(): string; + getPageElementType(): PageElementType; + getParentGroup(): Group; + getParentPage(): Page; + getRotation(): Number; + getTitle(): string; + getTop(): Number; + getTransform(): AffineTransform; + getWidth(): Number; + preconcatenateTransform(transform: AffineTransform): PageElement; + remove(): void; + scaleHeight(ratio: Number): PageElement; + scaleWidth(ratio: Number): PageElement; + select(): void; + select(replace: boolean): void; + setHeight(height: Number): PageElement; + setLeft(left: Number): PageElement; + setRotation(angle: Number): PageElement; + setTop(top: Number): PageElement; + setTransform(transform: AffineTransform): PageElement; + setWidth(width: Number): PageElement; + } + + /** + * A collection of one or more PageElement instances. + */ + export interface PageElementRange { + getPageElements(): PageElement[]; + } + + /** + * The page element type. + */ + export enum PageElementType { UNSUPPORTED, SHAPE, IMAGE, VIDEO, TABLE, GROUP, LINE, WORD_ART, SHEETS_CHART } + + /** + * A collection of one or more Page instances. + */ + export interface PageRange { + getPages(): Page[]; + } + + /** + * The page types. + */ + export enum PageType { UNSUPPORTED, SLIDE, LAYOUT, MASTER } + + /** + * A segment of text terminated by a newline character. + */ + export interface Paragraph { + getIndex(): Integer; + getRange(): TextRange; + } + + /** + * The types of text alignment for a paragraph. + */ + export enum ParagraphAlignment { UNSUPPORTED, START, CENTER, END, JUSTIFIED } + + /** + * The styles of text that apply to entire paragraphs. + * + * Read methods in this class return null if the corresponding TextRange spans + * multiple paragraphs, and those paragraphs have different values for the read method being called. + * To avoid this, query for paragraph styles using the TextRange returned by the Paragraph.getRange() method. + */ + export interface ParagraphStyle { + getIndentEnd(): Number; + getIndentFirstLine(): Number; + getIndentStart(): Number; + getLineSpacing(): Number; + getParagraphAlignment(): ParagraphAlignment; + getSpaceAbove(): Number; + getSpaceBelow(): Number; + getSpacingMode(): SpacingMode; + getTextDirection(): TextDirection; + setIndentEnd(indent: Number): ParagraphStyle; + setIndentFirstLine(indent: Number): ParagraphStyle; + setIndentStart(indent: Number): ParagraphStyle; + setLineSpacing(spacing: Number): ParagraphStyle; + setParagraphAlignment(alignment: ParagraphAlignment): ParagraphStyle; + setSpaceAbove(space: Number): ParagraphStyle; + setSpaceBelow(space: Number): ParagraphStyle; + setSpacingMode(mode: SpacingMode): ParagraphStyle; + setTextDirection(direction: TextDirection): ParagraphStyle; + } + + /** + * A fill that renders an image that's stretched to the dimensions of its container. + */ + export interface PictureFill { + getContentUrl(): string; + getSourceUrl(): string; + } + + /** + * The placeholder types. Many of these placeholder types correspond to placeholder IDs from the + * ECMA-376 standard. More information on those shapes can be found in the description of the + * "ST_PlaceholderType" type in section 19.7.10 of "Office Open XML File Formats - Fundamentals and + * Markup Language Reference", part 1 of ECMA-376 5th + * edition. + */ + export enum PlaceholderType { UNSUPPORTED, NONE, BODY, CHART, CLIP_ART, CENTERED_TITLE, DIAGRAM, DATE_AND_TIME, FOOTER, HEADER, MEDIA, OBJECT, PICTURE, SLIDE_NUMBER, SUBTITLE, TABLE, TITLE, SLIDE_IMAGE } + + /** + * A point representing a location. + */ + export interface Point { + getX(): Number; + getY(): Number; + } + + /** + * Predefined layouts. These are commonly found layouts in presentations. However, there is no + * guarantee that these layouts are present in the current master as they could have been deleted or + * not part of the used theme. Additionally, the placeholders on each layout may have been changed. + */ + export enum PredefinedLayout { UNSUPPORTED, BLANK, CAPTION_ONLY, TITLE, TITLE_AND_BODY, TITLE_AND_TWO_COLUMNS, TITLE_ONLY, SECTION_HEADER, SECTION_TITLE_AND_DESCRIPTION, ONE_COLUMN_TEXT, MAIN_POINT, BIG_NUMBER } + + /** + * A presentation. + */ + export interface Presentation { + addEditor(emailAddress: string): Presentation; + addEditor(user: Base.User): Presentation; + addEditors(emailAddresses: String[]): Presentation; + addViewer(emailAddress: string): Presentation; + addViewer(user: Base.User): Presentation; + addViewers(emailAddresses: String[]): Presentation; + appendSlide(): Slide; + appendSlide(layout: Layout): Slide; + appendSlide(predefinedLayout: PredefinedLayout): Slide; + appendSlide(slide: Slide): Slide; + getEditors(): Base.User[]; + getId(): string; + getLayouts(): Layout[]; + getMasters(): Master[]; + getName(): string; + getNotesMaster(): NotesMaster; + getNotesPageHeight(): Number; + getNotesPageWidth(): Number; + getPageHeight(): Number; + getPageWidth(): Number; + getSelection(): Selection; + getSlides(): Slide[]; + getUrl(): string; + getViewers(): Base.User[]; + insertSlide(insertionIndex: Integer): Slide; + insertSlide(insertionIndex: Integer, layout: Layout): Slide; + insertSlide(insertionIndex: Integer, predefinedLayout: PredefinedLayout): Slide; + insertSlide(insertionIndex: Integer, slide: Slide): Slide; + removeEditor(emailAddress: string): Presentation; + removeEditor(user: Base.User): Presentation; + removeViewer(emailAddress: string): Presentation; + removeViewer(user: Base.User): Presentation; + replaceAllText(findText: string, replaceText: string): Integer; + replaceAllText(findText: string, replaceText: string, matchCase: boolean): Integer; + saveAndClose(): void; + setName(name: string): void; + } + + /** + * A color defined by red, green, blue color channels. + */ + export interface RgbColor { + asHexString(): string; + getBlue(): Integer; + getColorType(): ColorType; + getGreen(): Integer; + getRed(): Integer; + } + + /** + * The user's selection in the active presentation. + * + * var selection = SlidesApp.getActivePresentation().getSelection(); + * var currentPage = selection.getCurrentPage(); + * var selectionType = selection.getSelectionType(); + * } + */ + export interface Selection { + getCurrentPage(): Page; + getPageElementRange(): PageElementRange; + getPageRange(): PageRange; + getSelectionType(): SelectionType; + getTableCellRange(): TableCellRange; + getTextRange(): TextRange; + } + + /** + * Type of Selection. + * + * The SelectionType represents the most specific type of one or more objects that are + * selected. As an example if one or more TableCell instances are selected in a Table, the selection type is SelectionType.TABLE_CELL. The TableCellRange can be + * retrieved by using the Selection.getTableCellRange. The Table can be retrieved by + * using the Selection.getPageElementRange and the Page can be retrieved from the + * Selection.getCurrentPage. + */ + export enum SelectionType { UNSUPPORTED, NONE, TEXT, TABLE_CELL, PAGE, PAGE_ELEMENT, CURRENT_PAGE } + + /** + * A PageElement representing a generic shape that does not have a more specific + * classification. Includes text boxes, rectangles, and other predefined shapes. + */ + export interface Shape { + alignOnPage(alignmentPosition: AlignmentPosition): Shape; + duplicate(): PageElement; + getBorder(): Border; + getContentAlignment(): ContentAlignment; + getDescription(): string; + getFill(): Fill; + getHeight(): Number; + getInherentHeight(): Number; + getInherentWidth(): Number; + getLeft(): Number; + getLink(): Link; + getObjectId(): string; + getPageElementType(): PageElementType; + getParentGroup(): Group; + getParentPage(): Page; + getParentPlaceholder(): PageElement; + getPlaceholderIndex(): Integer; + getPlaceholderType(): PlaceholderType; + getRotation(): Number; + getShapeType(): ShapeType; + getText(): TextRange; + getTitle(): string; + getTop(): Number; + getTransform(): AffineTransform; + getWidth(): Number; + preconcatenateTransform(transform: AffineTransform): Shape; + remove(): void; + removeLink(): void; + replaceWithImage(blobSource: Base.BlobSource): Image; + replaceWithImage(blobSource: Base.BlobSource, crop: boolean): Image; + replaceWithImage(imageUrl: string): Image; + replaceWithImage(imageUrl: string, crop: boolean): Image; + replaceWithSheetsChart(sourceChart: Spreadsheet.EmbeddedChart): SheetsChart; + replaceWithSheetsChartAsImage(sourceChart: Spreadsheet.EmbeddedChart): Image; + scaleHeight(ratio: Number): Shape; + scaleWidth(ratio: Number): Shape; + select(): void; + select(replace: boolean): void; + setContentAlignment(contentAlignment: ContentAlignment): Shape; + setHeight(height: Number): Shape; + setLeft(left: Number): Shape; + setLinkSlide(slideIndex: Integer): Link; + setLinkSlide(slide: Slide): Link; + setLinkSlide(slidePosition: SlidePosition): Link; + setLinkUrl(url: string): Link; + setRotation(angle: Number): Shape; + setTop(top: Number): Shape; + setTransform(transform: AffineTransform): Shape; + setWidth(width: Number): Shape; + } + + /** + * The shape types. Many of these shapes correspond to predefined shapes from the ECMA-376 standard. + * More information on those shapes can be found in the description of the "ST_ShapeType" simple + * type in section 20.1.10.55 of "Office Open XML File Formats - Fundamentals and Markup Language + * Reference", part 1 of ECMA-376 4th + * edition. + */ + export enum ShapeType { UNSUPPORTED, TEXT_BOX, RECTANGLE, ROUND_RECTANGLE, ELLIPSE, ARC, BENT_ARROW, BENT_UP_ARROW, BEVEL, BLOCK_ARC, BRACE_PAIR, BRACKET_PAIR, CAN, CHEVRON, CHORD, CLOUD, CORNER, CUBE, CURVED_DOWN_ARROW, CURVED_LEFT_ARROW, CURVED_RIGHT_ARROW, CURVED_UP_ARROW, DECAGON, DIAGONAL_STRIPE, DIAMOND, DODECAGON, DONUT, DOUBLE_WAVE, DOWN_ARROW, DOWN_ARROW_CALLOUT, FOLDED_CORNER, FRAME, HALF_FRAME, HEART, HEPTAGON, HEXAGON, HOME_PLATE, HORIZONTAL_SCROLL, IRREGULAR_SEAL_1, IRREGULAR_SEAL_2, LEFT_ARROW, LEFT_ARROW_CALLOUT, LEFT_BRACE, LEFT_BRACKET, LEFT_RIGHT_ARROW, LEFT_RIGHT_ARROW_CALLOUT, LEFT_RIGHT_UP_ARROW, LEFT_UP_ARROW, LIGHTNING_BOLT, MATH_DIVIDE, MATH_EQUAL, MATH_MINUS, MATH_MULTIPLY, MATH_NOT_EQUAL, MATH_PLUS, MOON, NO_SMOKING, NOTCHED_RIGHT_ARROW, OCTAGON, PARALLELOGRAM, PENTAGON, PIE, PLAQUE, PLUS, QUAD_ARROW, QUAD_ARROW_CALLOUT, RIBBON, RIBBON_2, RIGHT_ARROW, RIGHT_ARROW_CALLOUT, RIGHT_BRACE, RIGHT_BRACKET, ROUND_1_RECTANGLE, ROUND_2_DIAGONAL_RECTANGLE, ROUND_2_SAME_RECTANGLE, RIGHT_TRIANGLE, SMILEY_FACE, SNIP_1_RECTANGLE, SNIP_2_DIAGONAL_RECTANGLE, SNIP_2_SAME_RECTANGLE, SNIP_ROUND_RECTANGLE, STAR_10, STAR_12, STAR_16, STAR_24, STAR_32, STAR_4, STAR_5, STAR_6, STAR_7, STAR_8, STRIPED_RIGHT_ARROW, SUN, TRAPEZOID, TRIANGLE, UP_ARROW, UP_ARROW_CALLOUT, UP_DOWN_ARROW, UTURN_ARROW, VERTICAL_SCROLL, WAVE, WEDGE_ELLIPSE_CALLOUT, WEDGE_RECTANGLE_CALLOUT, WEDGE_ROUND_RECTANGLE_CALLOUT, FLOW_CHART_ALTERNATE_PROCESS, FLOW_CHART_COLLATE, FLOW_CHART_CONNECTOR, FLOW_CHART_DECISION, FLOW_CHART_DELAY, FLOW_CHART_DISPLAY, FLOW_CHART_DOCUMENT, FLOW_CHART_EXTRACT, FLOW_CHART_INPUT_OUTPUT, FLOW_CHART_INTERNAL_STORAGE, FLOW_CHART_MAGNETIC_DISK, FLOW_CHART_MAGNETIC_DRUM, FLOW_CHART_MAGNETIC_TAPE, FLOW_CHART_MANUAL_INPUT, FLOW_CHART_MANUAL_OPERATION, FLOW_CHART_MERGE, FLOW_CHART_MULTIDOCUMENT, FLOW_CHART_OFFLINE_STORAGE, FLOW_CHART_OFFPAGE_CONNECTOR, FLOW_CHART_ONLINE_STORAGE, FLOW_CHART_OR, FLOW_CHART_PREDEFINED_PROCESS, FLOW_CHART_PREPARATION, FLOW_CHART_PROCESS, FLOW_CHART_PUNCHED_CARD, FLOW_CHART_PUNCHED_TAPE, FLOW_CHART_SORT, FLOW_CHART_SUMMING_JUNCTION, FLOW_CHART_TERMINATOR, ARROW_EAST, ARROW_NORTH_EAST, ARROW_NORTH, SPEECH, STARBURST, TEARDROP, ELLIPSE_RIBBON, ELLIPSE_RIBBON_2, CLOUD_CALLOUT, CUSTOM } + + /** + * A PageElement representing a linked chart embedded from Google Sheets. + */ + export interface SheetsChart { + alignOnPage(alignmentPosition: AlignmentPosition): SheetsChart; + asImage(): Image; + duplicate(): PageElement; + getChartId(): Integer; + getDescription(): string; + getEmbedType(): SheetsChartEmbedType; + getHeight(): Number; + getInherentHeight(): Number; + getInherentWidth(): Number; + getLeft(): Number; + getLink(): Link; + getObjectId(): string; + getPageElementType(): PageElementType; + getParentGroup(): Group; + getParentPage(): Page; + getRotation(): Number; + getSpreadsheetId(): string; + getTitle(): string; + getTop(): Number; + getTransform(): AffineTransform; + getWidth(): Number; + preconcatenateTransform(transform: AffineTransform): SheetsChart; + refresh(): void; + remove(): void; + removeLink(): void; + scaleHeight(ratio: Number): SheetsChart; + scaleWidth(ratio: Number): SheetsChart; + select(): void; + select(replace: boolean): void; + setHeight(height: Number): SheetsChart; + setLeft(left: Number): SheetsChart; + setLinkSlide(slideIndex: Integer): Link; + setLinkSlide(slide: Slide): Link; + setLinkSlide(slidePosition: SlidePosition): Link; + setLinkUrl(url: string): Link; + setRotation(angle: Number): SheetsChart; + setTop(top: Number): SheetsChart; + setTransform(transform: AffineTransform): SheetsChart; + setWidth(width: Number): SheetsChart; + } + + /** + * The Sheets chart's embed type. + */ + export enum SheetsChartEmbedType { UNSUPPORTED, IMAGE } + + /** + * A slide in a presentation. + * + * These pages contain the content you are presenting to your audience. Most slides are based on + * a master and a layout. You can specify which layout to use for each slide when it is created. + */ + export interface Slide { + duplicate(): Slide; + getBackground(): PageBackground; + getColorScheme(): ColorScheme; + getGroups(): Group[]; + getImages(): Image[]; + getLayout(): Layout; + getLines(): Line[]; + getNotesPage(): NotesPage; + getObjectId(): string; + getPageElements(): PageElement[]; + getPageType(): PageType; + getPlaceholder(placeholderType: PlaceholderType): PageElement; + getPlaceholder(placeholderType: PlaceholderType, placeholderIndex: Integer): PageElement; + getPlaceholders(): PageElement[]; + getShapes(): Shape[]; + getSheetsCharts(): SheetsChart[]; + getTables(): Table[]; + getVideos(): Video[]; + getWordArts(): WordArt[]; + group(pageElements: PageElement[]): Group; + insertGroup(group: Group): Group; + insertImage(blobSource: Base.BlobSource): Image; + insertImage(blobSource: Base.BlobSource, left: Number, top: Number, width: Number, height: Number): Image; + insertImage(image: Image): Image; + insertImage(imageUrl: string): Image; + insertImage(imageUrl: string, left: Number, top: Number, width: Number, height: Number): Image; + insertLine(line: Line): Line; + insertLine(lineCategory: LineCategory, startLeft: Number, startTop: Number, endLeft: Number, endTop: Number): Line; + insertPageElement(pageElement: PageElement): PageElement; + insertShape(shape: Shape): Shape; + insertShape(shapeType: ShapeType): Shape; + insertShape(shapeType: ShapeType, left: Number, top: Number, width: Number, height: Number): Shape; + insertSheetsChart(sourceChart: Spreadsheet.EmbeddedChart): SheetsChart; + insertSheetsChart(sourceChart: Spreadsheet.EmbeddedChart, left: Number, top: Number, width: Number, height: Number): SheetsChart; + insertSheetsChart(sheetsChart: SheetsChart): SheetsChart; + insertSheetsChartAsImage(sourceChart: Spreadsheet.EmbeddedChart): Image; + insertSheetsChartAsImage(sourceChart: Spreadsheet.EmbeddedChart, left: Number, top: Number, width: Number, height: Number): Image; + insertTable(numRows: Integer, numColumns: Integer): Table; + insertTable(numRows: Integer, numColumns: Integer, left: Number, top: Number, width: Number, height: Number): Table; + insertTable(table: Table): Table; + insertVideo(videoUrl: string): Video; + insertVideo(videoUrl: string, left: Number, top: Number, width: Number, height: Number): Video; + insertVideo(video: Video): Video; + insertWordArt(wordArt: WordArt): WordArt; + move(index: Integer): void; + remove(): void; + replaceAllText(findText: string, replaceText: string): Integer; + replaceAllText(findText: string, replaceText: string, matchCase: boolean): Integer; + selectAsCurrentPage(): void; + } + + /** + * The relative position of a Slide. + */ + export enum SlidePosition { NEXT_SLIDE, PREVIOUS_SLIDE, FIRST_SLIDE, LAST_SLIDE } + + /** + * Creates and opens Presentations that can be edited. + * + * // Open a presentation by ID. + * var preso = SlidesApp.openById('PRESENTATION_ID_GOES_HERE'); + * + * // Create and open a presentation. + * preso = SlidesApp.create('Presentation Name'); + */ + export interface SlidesApp { + AlignmentPosition: typeof AlignmentPosition; + ArrowStyle: typeof ArrowStyle; + AutoTextType: typeof AutoTextType; + CellMergeState: typeof CellMergeState; + ColorType: typeof ColorType; + ContentAlignment: typeof ContentAlignment; + DashStyle: typeof DashStyle; + FillType: typeof FillType; + LineCategory: typeof LineCategory; + LineFillType: typeof LineFillType; + LineType: typeof LineType; + LinkType: typeof LinkType; + ListPreset: typeof ListPreset; + PageBackgroundType: typeof PageBackgroundType; + PageElementType: typeof PageElementType; + PageType: typeof PageType; + ParagraphAlignment: typeof ParagraphAlignment; + PlaceholderType: typeof PlaceholderType; + PredefinedLayout: typeof PredefinedLayout; + SelectionType: typeof SelectionType; + ShapeType: typeof ShapeType; + SheetsChartEmbedType: typeof SheetsChartEmbedType; + SlidePosition: typeof SlidePosition; + SpacingMode: typeof SpacingMode; + TextBaselineOffset: typeof TextBaselineOffset; + TextDirection: typeof TextDirection; + ThemeColorType: typeof ThemeColorType; + VideoSourceType: typeof VideoSourceType; + create(name: string): Presentation; + getActivePresentation(): Presentation; + getUi(): Base.Ui; + newAffineTransformBuilder(): AffineTransformBuilder; + openById(id: string): Presentation; + openByUrl(url: string): Presentation; + } + + /** + * A solid color fill. + * + * SolidFill objects are detached and immutable, so do not reflect changes made after + * they have been created. + */ + export interface SolidFill { + getAlpha(): Number; + getColor(): Color; + } + + /** + * The different modes for paragraph spacing. + */ + export enum SpacingMode { UNSUPPORTED, NEVER_COLLAPSE, COLLAPSE_LISTS } + + /** + * A PageElement representing a table. + */ + export interface Table { + alignOnPage(alignmentPosition: AlignmentPosition): Table; + appendColumn(): TableColumn; + appendRow(): TableRow; + duplicate(): PageElement; + getCell(rowIndex: Integer, columnIndex: Integer): TableCell; + getColumn(columnIndex: Integer): TableColumn; + getDescription(): string; + getHeight(): Number; + getInherentHeight(): Number; + getInherentWidth(): Number; + getLeft(): Number; + getNumColumns(): Integer; + getNumRows(): Integer; + getObjectId(): string; + getPageElementType(): PageElementType; + getParentGroup(): Group; + getParentPage(): Page; + getRotation(): Number; + getRow(rowIndex: Integer): TableRow; + getTitle(): string; + getTop(): Number; + getTransform(): AffineTransform; + getWidth(): Number; + insertColumn(index: Integer): TableColumn; + insertRow(index: Integer): TableRow; + preconcatenateTransform(transform: AffineTransform): Table; + remove(): void; + scaleHeight(ratio: Number): Table; + scaleWidth(ratio: Number): Table; + select(): void; + select(replace: boolean): void; + setHeight(height: Number): Table; + setLeft(left: Number): Table; + setRotation(angle: Number): Table; + setTop(top: Number): Table; + setTransform(transform: AffineTransform): Table; + setWidth(width: Number): Table; + } + + /** + * A cell in a table. + */ + export interface TableCell { + getColumnIndex(): Integer; + getColumnSpan(): Integer; + getContentAlignment(): ContentAlignment; + getFill(): Fill; + getHeadCell(): TableCell; + getMergeState(): CellMergeState; + getParentColumn(): TableColumn; + getParentRow(): TableRow; + getParentTable(): Table; + getRowIndex(): Integer; + getRowSpan(): Integer; + getText(): TextRange; + setContentAlignment(contentAlignment: ContentAlignment): TableCell; + } + + /** + * A collection of one or more TableCell instances. + */ + export interface TableCellRange { + getTableCells(): TableCell[]; + } + + /** + * A column in a table. A column consists of a list of table cells. A column is identified by the + * column index. + */ + export interface TableColumn { + getCell(cellIndex: Integer): TableCell; + getIndex(): Integer; + getNumCells(): Integer; + getParentTable(): Table; + getWidth(): Number; + remove(): void; + } + + /** + * A row in a table. A row consists of a list of table cells. A row is identified by the row index. + */ + export interface TableRow { + getCell(cellIndex: Integer): TableCell; + getIndex(): Integer; + getMinimumHeight(): Number; + getNumCells(): Integer; + getParentTable(): Table; + remove(): void; + } + + /** + * The text vertical offset from its normal position. + */ + export enum TextBaselineOffset { UNSUPPORTED, NONE, SUPERSCRIPT, SUBSCRIPT } + + /** + * The directions text can flow in. + */ + export enum TextDirection { UNSUPPORTED, LEFT_TO_RIGHT, RIGHT_TO_LEFT } + + /** + * A segment of the text contents of a Shape or a TableCell. + */ + export interface TextRange { + appendParagraph(text: string): Paragraph; + appendRange(textRange: TextRange): TextRange; + appendRange(textRange: TextRange, matchSourceFormatting: boolean): TextRange; + appendText(text: string): TextRange; + asRenderedString(): string; + asString(): string; + clear(): void; + clear(startOffset: Integer, endOffset: Integer): void; + find(pattern: string): TextRange[]; + find(pattern: string, startOffset: Integer): TextRange[]; + getAutoTexts(): AutoText[]; + getEndIndex(): Integer; + getLength(): Integer; + getLinks(): TextRange[]; + getListParagraphs(): Paragraph[]; + getListStyle(): ListStyle; + getParagraphStyle(): ParagraphStyle; + getParagraphs(): Paragraph[]; + getRange(startOffset: Integer, endOffset: Integer): TextRange; + getRuns(): TextRange[]; + getStartIndex(): Integer; + getTextStyle(): TextStyle; + insertParagraph(startOffset: Integer, text: string): Paragraph; + insertRange(startOffset: Integer, textRange: TextRange): TextRange; + insertRange(startOffset: Integer, textRange: TextRange, matchSourceFormatting: boolean): TextRange; + insertText(startOffset: Integer, text: string): TextRange; + isEmpty(): boolean; + replaceAllText(findText: string, replaceText: string): Integer; + replaceAllText(findText: string, replaceText: string, matchCase: boolean): Integer; + select(): void; + setText(newText: string): TextRange; + } + + /** + * The style of text. + * + * Read methods in this class return null if the corresponding TextRange spans + * multiple text runs, and those runs have different values for the read method being called. To + * avoid this, query for text styles using the TextRanges returned by the TextRange.getRuns() method. + */ + export interface TextStyle { + getBackgroundColor(): Color; + getBaselineOffset(): TextBaselineOffset; + getFontFamily(): string; + getFontSize(): Number; + getFontWeight(): Integer; + getForegroundColor(): Color; + getLink(): Link; + hasLink(): boolean; + isBackgroundTransparent(): boolean; + isBold(): boolean; + isItalic(): boolean; + isSmallCaps(): boolean; + isStrikethrough(): boolean; + isUnderline(): boolean; + removeLink(): TextStyle; + setBackgroundColor(color: Color): TextStyle; + setBackgroundColor(red: Integer, green: Integer, blue: Integer): TextStyle; + setBackgroundColor(hexColor: string): TextStyle; + setBackgroundColor(color: ThemeColorType): TextStyle; + setBackgroundColorTransparent(): TextStyle; + setBaselineOffset(offset: TextBaselineOffset): TextStyle; + setBold(bold: boolean): TextStyle; + setFontFamily(fontFamily: string): TextStyle; + setFontFamilyAndWeight(fontFamily: string, fontWeight: Integer): TextStyle; + setFontSize(fontSize: Number): TextStyle; + setForegroundColor(foregroundColor: Color): TextStyle; + setForegroundColor(red: Integer, green: Integer, blue: Integer): TextStyle; + setForegroundColor(hexColor: string): TextStyle; + setForegroundColor(color: ThemeColorType): TextStyle; + setItalic(italic: boolean): TextStyle; + setLinkSlide(slideIndex: Integer): TextStyle; + setLinkSlide(slide: Slide): TextStyle; + setLinkSlide(slidePosition: SlidePosition): TextStyle; + setLinkUrl(url: string): TextStyle; + setSmallCaps(smallCaps: boolean): TextStyle; + setStrikethrough(strikethrough: boolean): TextStyle; + setUnderline(underline: boolean): TextStyle; + } + + /** + * A color that refers to an entry in the page's ColorScheme. + */ + export interface ThemeColor { + getColorType(): ColorType; + getThemeColorType(): ThemeColorType; + } + + /** + * The name of an entry in the page's color scheme. + */ + export enum ThemeColorType { UNSUPPORTED, DARK1, LIGHT1, DARK2, LIGHT2, ACCENT1, ACCENT2, ACCENT3, ACCENT4, ACCENT5, ACCENT6, HYPERLINK, FOLLOWED_HYPERLINK } + + /** + * A PageElement representing a video. + */ + export interface Video { + alignOnPage(alignmentPosition: AlignmentPosition): Video; + duplicate(): PageElement; + getBorder(): Border; + getDescription(): string; + getHeight(): Number; + getInherentHeight(): Number; + getInherentWidth(): Number; + getLeft(): Number; + getObjectId(): string; + getPageElementType(): PageElementType; + getParentGroup(): Group; + getParentPage(): Page; + getRotation(): Number; + getSource(): VideoSourceType; + getThumbnailUrl(): string; + getTitle(): string; + getTop(): Number; + getTransform(): AffineTransform; + getUrl(): string; + getVideoId(): string; + getWidth(): Number; + preconcatenateTransform(transform: AffineTransform): Video; + remove(): void; + scaleHeight(ratio: Number): Video; + scaleWidth(ratio: Number): Video; + select(): void; + select(replace: boolean): void; + setHeight(height: Number): Video; + setLeft(left: Number): Video; + setRotation(angle: Number): Video; + setTop(top: Number): Video; + setTransform(transform: AffineTransform): Video; + setWidth(width: Number): Video; + } + + /** + * The video source types. + */ + export enum VideoSourceType { UNSUPPORTED, YOUTUBE } + + /** + * A PageElement representing word art. + */ + export interface WordArt { + alignOnPage(alignmentPosition: AlignmentPosition): WordArt; + duplicate(): PageElement; + getDescription(): string; + getHeight(): Number; + getInherentHeight(): Number; + getInherentWidth(): Number; + getLeft(): Number; + getLink(): Link; + getObjectId(): string; + getPageElementType(): PageElementType; + getParentGroup(): Group; + getParentPage(): Page; + getRenderedText(): string; + getRotation(): Number; + getTitle(): string; + getTop(): Number; + getTransform(): AffineTransform; + getWidth(): Number; + preconcatenateTransform(transform: AffineTransform): WordArt; + remove(): void; + removeLink(): void; + scaleHeight(ratio: Number): WordArt; + scaleWidth(ratio: Number): WordArt; + select(): void; + select(replace: boolean): void; + setHeight(height: Number): WordArt; + setLeft(left: Number): WordArt; + setLinkSlide(slideIndex: Integer): Link; + setLinkSlide(slide: Slide): Link; + setLinkSlide(slidePosition: SlidePosition): Link; + setLinkUrl(url: string): Link; + setRotation(angle: Number): WordArt; + setTop(top: Number): WordArt; + setTransform(transform: AffineTransform): WordArt; + setWidth(width: Number): WordArt; + } + + } +} + +declare var SlidesApp: GoogleAppsScript.Slides.SlidesApp; diff --git a/types/google-apps-script/index.d.ts b/types/google-apps-script/index.d.ts index 0e4ca164a9..df2cca1363 100644 --- a/types/google-apps-script/index.d.ts +++ b/types/google-apps-script/index.d.ts @@ -26,6 +26,7 @@ /// /// /// +/// /// /// /// diff --git a/types/google.analytics/google.analytics-tests.ts b/types/google.analytics/google.analytics-tests.ts index 5256f636c7..63ca4e5ca4 100644 --- a/types/google.analytics/google.analytics-tests.ts +++ b/types/google.analytics/google.analytics-tests.ts @@ -33,6 +33,13 @@ describe('UniversalAnalytics', () => { ga('send', 'timing', {timingCategory: 'category', timingVar: 'lookup', timingValue: 123, timingLabel: 'label'}); ga('trackerName.send', 'event', 'load'); + ga('require', 'somePlugin'); + ga('require', 'somePlugin', 'option'); + ga('require', 'somePlugin', { some: 'options' }); + ga('provide', 'somePlugin', () => {}); + ga('provide', 'somePlugin', tracker => {}); + ga('provide', 'somePlugin', (tracker, options) => {}); + ga.create('UA-65432-1', 'auto'); ga.create('UA-65432-1', {some: 'config'}); ga.create('UA-65432-1', 'auto', {some: 'config'}); diff --git a/types/google.analytics/index.d.ts b/types/google.analytics/index.d.ts index b7d4a8a6f4..b71fdef286 100644 --- a/types/google.analytics/index.d.ts +++ b/types/google.analytics/index.d.ts @@ -601,6 +601,8 @@ declare namespace UniversalAnalytics { }): void; (command: 'send', fieldsObject: FieldsObject): void; (command: string, hitType: HitType, ...fields: any[]): void; + (command: 'require', pluginName: string, pluginOptions?: any): void; + (command: 'provide', pluginName: string, pluginConstructor: (tracker: Tracker, pluginOptions?: Object) => void): void; (command: 'create', trackingId: string, cookieDomain?: string, name?: string, fieldsObject?: FieldsObject): void; (command: 'remove'): void; diff --git a/types/grid-styled/package.json b/types/grid-styled/package.json index c381522c0d..f8a379b117 100644 --- a/types/grid-styled/package.json +++ b/types/grid-styled/package.json @@ -1,6 +1,6 @@ { "private": true, "dependencies": { - "styled-components": ">=2.0 || >=3.0" + "styled-components": "2.x - 3.x" } } diff --git a/types/h2o2/tsconfig.json b/types/h2o2/tsconfig.json index 9d5b689ee1..767fa4e7b7 100644 --- a/types/h2o2/tsconfig.json +++ b/types/h2o2/tsconfig.json @@ -17,8 +17,14 @@ "boom": [ "boom/v4" ], + "catbox": [ + "catbox/v7" + ], "hapi": [ "hapi/v16" + ], + "inert": [ + "inert/v4" ] }, "noEmit": true, diff --git a/types/hapi-auth-basic/tsconfig.json b/types/hapi-auth-basic/tsconfig.json index 191d992f70..80aa0fbace 100644 --- a/types/hapi-auth-basic/tsconfig.json +++ b/types/hapi-auth-basic/tsconfig.json @@ -13,11 +13,6 @@ "../" ], "types": [], - "paths": { - "boom": [ - "boom/v4" - ] - }, "noEmit": true, "forceConsistentCasingInFileNames": true }, diff --git a/types/hapi-auth-jwt2/tsconfig.json b/types/hapi-auth-jwt2/tsconfig.json index 1f8cc10075..19a6e785ac 100644 --- a/types/hapi-auth-jwt2/tsconfig.json +++ b/types/hapi-auth-jwt2/tsconfig.json @@ -17,8 +17,14 @@ "boom": [ "boom/v4" ], + "catbox": [ + "catbox/v7" + ], "hapi": [ "hapi/v16" + ], + "inert": [ + "inert/v4" ] }, "noEmit": true, @@ -28,4 +34,4 @@ "index.d.ts", "hapi-auth-jwt2-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/hapi-decorators/tsconfig.json b/types/hapi-decorators/tsconfig.json index 44437f4b9e..6434d0422e 100644 --- a/types/hapi-decorators/tsconfig.json +++ b/types/hapi-decorators/tsconfig.json @@ -19,8 +19,14 @@ "boom": [ "boom/v4" ], + "catbox": [ + "catbox/v7" + ], "hapi": [ "hapi/v16" + ], + "inert": [ + "inert/v4" ] }, "noEmit": true, @@ -30,4 +36,4 @@ "index.d.ts", "hapi-decorators-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/hapi/index.d.ts b/types/hapi/index.d.ts index f65cee14d4..aebef5e5d8 100644 --- a/types/hapi/index.d.ts +++ b/types/hapi/index.d.ts @@ -334,6 +334,10 @@ export interface RequestLog { channel: string; } +export interface RequestQuery { + [key: string]: string | string[]; +} + /** * The request object is created internally for each incoming request. It is not the same object received from the node * HTTP server callback (which is available via [request.raw.req](https://github.com/hapijs/hapi/blob/master/API.md#request.raw)). The request properties change throughout @@ -453,7 +457,7 @@ export interface Request extends Podium { * The response object when set. The object can be modified but must not be assigned another object. To replace the response with another from within an extension point, use reply(response) to * override with a different response. Contains null when no response has been set (e.g. when a request terminates prematurely when the client disconnects). */ - response: ResponseObject | Boom.BoomError | null; + response: ResponseObject | Boom.Boom | null; /** * Same as pre but represented as the response object created by the pre method. @@ -464,7 +468,7 @@ export interface Request extends Podium { * By default the object outputted from node's URL parse() method. Might also be set indirectly via request.setUrl in which case it may be a string (if url is set to an object with the query * attribute as an unparsed string). */ - readonly query: any; + readonly query: RequestQuery | string; /** * An object containing the Node HTTP server objects. Direct interaction with these raw objects is not recommended. @@ -1629,6 +1633,13 @@ export interface RouteOptionsValidate { */ export type RouteCompressionEncoderSettings = object; +/** + * Empty interface to allow for user-defined augmentations. + */ +/* tslint:disable-next-line:no-empty-interface */ +export interface RouteOptionsApp { +} + /** * Each route can be customized to change the default behavior of the request lifecycle. * For context [See docs](https://github.com/hapijs/hapi/blob/master/API.md#route-options) @@ -1638,7 +1649,7 @@ export interface RouteOptions { * Application-specific route configuration state. Should not be used by plugins which should use options.plugins[name] instead. * [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-routeoptionsapp) */ - app?: any; + app?: RouteOptionsApp; /** * Route authentication configuration. Value can be: @@ -2574,7 +2585,7 @@ export interface ServerInjectOptions extends Shot.RequestOptions { /** * sets the initial value of request.app, defaults to {}. */ - app?: any; + app?: ApplicationState; /** * sets the initial value of request.plugins, defaults to {}. */ @@ -2656,7 +2667,7 @@ export interface ServerMethodOptions { * unique key if the function's arguments are all of types 'string', 'number', or 'boolean'. However if the method uses other types of arguments, a key generation function must be provided which * takes the same arguments as the function and returns a unique string (or null if no key can be generated). */ - generateKey?: (...args: any[]) => any; + generateKey?: (...args: any[]) => string | null; } /** @@ -2710,6 +2721,13 @@ export interface ServerOptionsCompression { minBytes: number; } +/** + * Empty interface to allow for custom augmentation. + */ +/* tslint:disable-next-line:no-empty-interface */ +export interface ServerOptionsApp { +} + /** * The server options control the behavior of the server object. Note that the options object is deeply cloned * (with the exception of listener which is shallowly copied) and should not contain any values that are unsafe to perform deep copy on. @@ -2732,7 +2750,7 @@ export interface ServerOptions { * state. * [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-serveroptionsapp) */ - app?: any; + app?: ServerOptionsApp; /** * Default value: true. @@ -3212,6 +3230,13 @@ export interface HandlerDecorationMethod { */ export type DecorationMethod = (this: T, ...args: any[]) => any; +/** + * An empty interface to allow typings of custom plugin properties. + */ +/* tslint:disable-next-line:no-empty-interface */ +export interface PluginProperties { +} + /** * The server object is the main application container. The server manages all incoming requests along with all * the facilities provided by the framework. Each server supports a single connection (e.g. listen to port 80). @@ -3363,7 +3388,7 @@ export class Server extends Podium { * the server.plugins[name] object directly or via the server.expose() method. * [See docs](https://github.com/hapijs/hapi/blob/master/API.md#-serverplugins) */ - plugins: any; + plugins: PluginProperties; /** * The realm object contains sandboxed server settings specific to each plugin or authentication strategy. When @@ -3847,7 +3872,7 @@ export namespace Lifecycle { type ReturnValueTypes = (null | string | number | boolean) | (Buffer) | - (Error | Boom.BoomError) | + (Error | Boom.Boom) | (stream.Stream) | (object | object[]) | symbol | diff --git a/types/hapi/test/request/query.ts b/types/hapi/test/request/query.ts index c67381f1b9..090ab3ae8d 100644 --- a/types/hapi/test/request/query.ts +++ b/types/hapi/test/request/query.ts @@ -1,14 +1,17 @@ // Added test in addition to docs, for request.query -import { Lifecycle, Request, ResponseToolkit, Server, ServerOptions, ServerRoute } from "hapi"; +import { Lifecycle, Request, RequestQuery, ResponseToolkit, Server, ServerOptions, ServerRoute } from "hapi"; const options: ServerOptions = { port: 8000, }; const handlerFn: Lifecycle.Method = (request, h) => { - const query = request.query as GetThingQuery; + const query1 = request.query as string; + console.log(query1); + + const query2 = request.query as RequestQuery; // http://localhost:8000/?name=test - return `You asked for ${query.name}`; + return `You asked for ${query2.name}`; }; const serverRoute: ServerRoute = { @@ -17,10 +20,6 @@ const serverRoute: ServerRoute = { handler: handlerFn }; -interface GetThingQuery { - name: string; -} - const server = new Server(options); server.route(serverRoute); server.start(); diff --git a/types/hapi/test/route/route-options.ts b/types/hapi/test/route/route-options.ts index 96237debd8..d114154e60 100644 --- a/types/hapi/test/route/route-options.ts +++ b/types/hapi/test/route/route-options.ts @@ -102,8 +102,18 @@ const routeOptionsValidate: RouteOptionsValidate = { query: true, }; +declare module 'hapi' { + interface RouteOptionsApp { + one: number; + two: string; + } +} + const routeOptions: RouteOptions = { - app: {}, + app: { + one: 1, + two: "2" + }, auth: routeOptionsAccess, bind: null, cache: { diff --git a/types/hapi/test/server/server-app.ts b/types/hapi/test/server/server-app.ts index f51ad7ca12..8e9cff88b0 100644 --- a/types/hapi/test/server/server-app.ts +++ b/types/hapi/test/server/server-app.ts @@ -8,7 +8,7 @@ const options: ServerOptions = { declare module "hapi" { // Demonstrate augmenting the application state. interface ApplicationState { - key: string; + key?: string; } } diff --git a/types/hapi/test/server/server-cache-provision.ts b/types/hapi/test/server/server-cache-provision.ts index f30ce65cd6..1e120348b2 100644 --- a/types/hapi/test/server/server-cache-provision.ts +++ b/types/hapi/test/server/server-cache-provision.ts @@ -9,8 +9,8 @@ server.initialize(); server.cache.provision({engine: require('catbox-memory'), name: 'countries' }); const cache: catbox.Policy = server.cache({segment: 'countries', cache: 'countries', expiresIn: 60 * 60 * 1000 }); -cache.set('norway', 'oslo', 10 * 1000, () => {}); -const value = cache.get('norway', () => {}); +cache.set('norway', 'oslo', 10 * 1000).then(() => {}); +const value = cache.get('norway').then(() => {}); server.start(); diff --git a/types/hapi/test/server/server-cache.ts b/types/hapi/test/server/server-cache.ts index 64f8c85e80..6aa612f3f1 100644 --- a/types/hapi/test/server/server-cache.ts +++ b/types/hapi/test/server/server-cache.ts @@ -11,9 +11,9 @@ const catboxOptions: ServerOptionsCache = { expiresIn: 60 * 60 * 1000 }; const cache: catbox.Policy = server.cache(catboxOptions); -cache.set('norway', 'oslo', 10 * 1000, () => {}); +cache.set('norway', 'oslo', 10 * 1000).then(() => {}); -const value = cache.get('norway', () => {}); +const value = cache.get('norway').then(() => {}); console.log("Value: " + value); server.start(); diff --git a/types/hapi/test/server/server-expose.ts b/types/hapi/test/server/server-expose.ts index c1a698b6c7..43d6cfdaa6 100644 --- a/types/hapi/test/server/server-expose.ts +++ b/types/hapi/test/server/server-expose.ts @@ -1,6 +1,17 @@ // https://github.com/hapijs/hapi/blob/master/API.md#-serverplugins import { Plugin, Server, ServerRegisterOptions } from "hapi"; +declare module 'hapi' { + interface PluginProperties { + example1: { + util(): void; + }; + example2: { + util(): void; + }; + } +} + const plugin1: Plugin = { name: 'example1', async register(server: Server, options: ServerRegisterOptions) { @@ -22,3 +33,6 @@ const server = new Server({ server.start(); server.register(plugin1); server.register(plugin2); + +server.plugins.example1.util(); +server.plugins.example2.util(); diff --git a/types/hapi/test/server/server-inject.ts b/types/hapi/test/server/server-inject.ts index 5c7942c16a..a2ae777a71 100644 --- a/types/hapi/test/server/server-inject.ts +++ b/types/hapi/test/server/server-inject.ts @@ -17,3 +17,16 @@ server.route(serverRoute); server.start(); server.inject('/').then(res => console.log(res.result)); + +declare module 'hapi' { + interface ApplicationState { + injectState?: number; + } +} + +server.inject({ + url: "test", + app: { + injectState: 1 + } +}); diff --git a/types/hapi/test/server/server-method.ts b/types/hapi/test/server/server-method.ts index 2d2b3bdf58..bb729516b7 100644 --- a/types/hapi/test/server/server-method.ts +++ b/types/hapi/test/server/server-method.ts @@ -17,7 +17,8 @@ const methodObject: ServerMethodConfigurationObject = { cache: { expiresIn: 2000, generateTimeout: 100 - } + }, + generateKey: (a: string | undefined) => a === undefined ? null : a } }; diff --git a/types/hapi/test/server/server-options.ts b/types/hapi/test/server/server-options.ts index ce487bbb20..030c721103 100644 --- a/types/hapi/test/server/server-options.ts +++ b/types/hapi/test/server/server-options.ts @@ -54,6 +54,14 @@ const routeOptions: RouteOptions = { }, }; +declare module 'hapi' { + interface ServerOptionsApp { + key1?: string; + key2?: string; + any_thing?: string; + } +} + const options: ServerOptions = { address: '0.0.0.0', app: { diff --git a/types/hapi/test/server/server-plugins.ts b/types/hapi/test/server/server-plugins.ts index 970b53fb6d..7f3d194f84 100644 --- a/types/hapi/test/server/server-plugins.ts +++ b/types/hapi/test/server/server-plugins.ts @@ -13,6 +13,15 @@ interface Plugin3 { three: 3; } +declare module 'hapi' { + interface PluginProperties { + example: { + other: string; + key: string; + }; + } +} + const plugin1: Plugin = { name: 'plugin1', register: async (server: Server, options: Plugin1) => { diff --git a/types/hapi/test/server/server-settings.ts b/types/hapi/test/server/server-settings.ts index 488e31629b..f0619d95da 100644 --- a/types/hapi/test/server/server-settings.ts +++ b/types/hapi/test/server/server-settings.ts @@ -1,6 +1,12 @@ // https://github.com/hapijs/hapi/blob/master/API.md#-serversettings import { Server } from "hapi"; +declare module 'hapi' { + interface ServerOptionsApp { + key?: string; + } +} + const server = new Server({ port: 8000, app: { diff --git a/types/hapi/tsconfig.json b/types/hapi/tsconfig.json index f8db3fc828..c93f0dfc7f 100644 --- a/types/hapi/tsconfig.json +++ b/types/hapi/tsconfig.json @@ -13,11 +13,6 @@ "../" ], "types": [], - "paths": { - "boom": [ - "boom/v4" - ] - }, "noEmit": true, "forceConsistentCasingInFileNames": true }, diff --git a/types/hapi/v16/tsconfig.json b/types/hapi/v16/tsconfig.json index d3d30f97dc..23087e8eff 100644 --- a/types/hapi/v16/tsconfig.json +++ b/types/hapi/v16/tsconfig.json @@ -17,8 +17,14 @@ "boom": [ "boom/v4" ], + "catbox": [ + "catbox/v7" + ], "hapi": [ "hapi/v16" + ], + "inert": [ + "inert/v4" ] }, "noEmit": true, diff --git a/types/hellojs/hellojs-tests.ts b/types/hellojs/hellojs-tests.ts index e5b76d3ceb..4a4e068379 100644 --- a/types/hellojs/hellojs-tests.ts +++ b/types/hellojs/hellojs-tests.ts @@ -1,7 +1,3 @@ -import * as hello from 'hellojs'; - -// Test code copied from Azure AD B2C sample app at -// https://github.com/Azure-Samples/active-directory-b2c-javascript-hellojs-singlepageapp/tree/cd5982f09a7bff0a72b7b4e44c4b5190b09e20fa hello.init({ serviceName: { name: 'Test', diff --git a/types/hellojs/index.d.ts b/types/hellojs/index.d.ts index 16b19afb4a..e8efdaf19c 100644 --- a/types/hellojs/index.d.ts +++ b/types/hellojs/index.d.ts @@ -1,11 +1,13 @@ -// Type definitions for hello.js 1.15 +// Type definitions for hello.js 1.16 // Project: http://adodson.com/hello.js/ // Definitions by: Pavel Zika // Mikko Vuorinen +// Vincent Biret // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 export = hello; +export as namespace hello; declare const hello: hello.HelloJSStatic; @@ -53,9 +55,11 @@ declare namespace hello { type HelloJSTokenResponseType = "token" | "code"; + type HelloJSDisplayType = "popup" | "page" | "none"; + interface HelloJSLoginOptions { redirect_uri?: string; - display?: string; + display?: HelloJSDisplayType; scope?: string; response_type?: HelloJSTokenResponseType; force?: boolean | null; @@ -87,19 +91,39 @@ declare namespace hello { interface HelloJSEventArgument { network: string; - authResponse?: any; + authResponse?: HelloJSAuthResponse; + } + + interface HelloJSLoginEventArguement { + network: string; + authResponse?: HelloJSAuthResponse; + error?: Error; + } + + interface HelloJSAuthResponse { + access_token?: string; + token_type?: string; + expires_in?: number; + id_token?: string; + state?: string; + session_state?: string; + network?: string; + display?: HelloJSDisplayType; + redirect_uri?: string; + scope?: string; + expires?: number; } interface HelloJSStatic extends HelloJSEvent { init(serviceAppIds: { [id: string]: string; }, options?: HelloJSLoginOptions): void; init(servicesDef: { [id: string]: HelloJSServiceDef; }): void; - login(callback: () => void): PromiseLike; - login(options?: HelloJSLoginOptions, callback?: () => void): PromiseLike; - login(network?: string, options?: HelloJSLoginOptions, callback?: () => void): PromiseLike; + login(callback: () => void): PromiseLike; + login(options?: HelloJSLoginOptions, callback?: () => void): PromiseLike; + login(network?: string, options?: HelloJSLoginOptions, callback?: () => void): PromiseLike; logout(callback?: () => void): PromiseLike; logout(options?: HelloJSLogoutOptions, callback?: () => void): PromiseLike; logout(network?: string, options?: HelloJSLogoutOptions, callback?: () => void): PromiseLike; - getAuthResponse(network?: string): any; + getAuthResponse(network?: string): HelloJSAuthResponse; settings: HelloJSLoginOptions; (network: string): HelloJSStatic; utils: HelloJSUtils; diff --git a/types/inert/index.d.ts b/types/inert/index.d.ts index e74d1a4ce9..d8c1d90422 100644 --- a/types/inert/index.d.ts +++ b/types/inert/index.d.ts @@ -1,16 +1,28 @@ -// Type definitions for inert 4.2 +// Type definitions for inert 5.1 // Project: https://github.com/hapijs/inert/ -// Definitions by: Steve Ognibene , AJP +// Definitions by: Steve Ognibene +// Alexander James Phillips +// Silas Rech // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 -import * as hapi from 'hapi'; +import { + Plugin, + Request, +} from 'hapi'; declare namespace inert { - export interface ReplyFileHandlerOptions { - /** confine - serve file relative to this directory and returns 403 Forbidden if the path resolves outside the confine directory. Defaults to true which uses the relativeTo route option as the confine. Set to false to disable this security feature. */ + type RequestHandler = (request: Request) => T; + + interface ReplyFileHandlerOptions { + /** + * confine - serve file relative to this directory and returns 403 Forbidden if the path resolves outside the confine directory. + * Defaults to true which uses the relativeTo route option as the confine. Set to false to disable this security feature. + */ confine?: boolean; - /** filename - an optional filename to specify if sending a 'Content-Disposition' header, defaults to the basename of path */ + /** + * filename - an optional filename to specify if sending a 'Content-Disposition' header, defaults to the basename of path + */ filename?: string; /** * mode - specifies whether to include the 'Content-Disposition' header with the response. Available values: @@ -19,9 +31,13 @@ declare namespace inert { * *'inline' */ mode?: false | 'attachment' | 'inline'; - /** lookupCompressed - if true, looks for for a pre-compressed version of the file with the same filename with an extension, depending on the accepted encoding. Defaults to false. */ + /** + * lookupCompressed - if true, looks for for a pre-compressed version of the file with the same filename with an extension, depending on the accepted encoding. Defaults to false. + */ lookupCompressed?: boolean; - /** lookupMap - an object which maps content encoding to expected file name extension. Defaults to `{ gzip: '.gz' }. */ + /** + * lookupMap - an object which maps content encoding to expected file name extension. Defaults to `{ gzip: '.gz' }. + */ lookupMap?: {[index: string]: string}; /** * etagMethod - specifies the method used to calculate the ETag header response. Available values: @@ -30,33 +46,56 @@ declare namespace inert { * * false - Disable ETag computation. */ etagMethod?: 'hash' | 'simple' | false; - /** start - offset in file to reading from, defaults to 0. */ + /** + * start - offset in file to reading from, defaults to 0. + */ start?: number; - /** end - offset in file to stop reading from. If not set, will read to end of file. */ + /** + * end - offset in file to stop reading from. If not set, will read to end of file. + */ end?: number; } - export interface FileHandlerRouteObject extends ReplyFileHandlerOptions { - /** path - a path string or function as described above (required). */ - path: string | hapi.RequestHandler; + interface FileHandlerRouteObject extends ReplyFileHandlerOptions { + /** + * path - a path string or function as described above (required). + */ + path: string | RequestHandler; } - export interface DirectoryHandlerRouteObject { - /** path - (required) the directory root path (relative paths are resolved based on the route files configuration). Value can be: - * * a single path string used as the prefix for any resources requested by appending the request path parameter to the provided string. - * * an array of path strings. Each path will be attempted in order until a match is found (by following the same process as the single path string). - * * a function with the signature function(request) which returns the path string or an array of path strings. If the function returns an error, the error is passed back to the client in the response. + interface DirectoryHandlerRouteObject { + /** + * path - (required) the directory root path (relative paths are resolved based on the route files configuration). Value can be: + * * a single path string used as the prefix for any resources requested by appending the request path parameter to the provided string. + * * an array of path strings. Each path will be attempted in order until a match is found (by following the same process as the single path string). + * * a function with the signature function(request) which returns the path string or an array of path strings. + * If the function returns an error, the error is passed back to the client in the response. + */ + path: string | string[] | RequestHandler; + /** + * index - optional boolean|string|string[], determines if an index file will be served if found in the folder when requesting a directory. + * The given string or strings specify the name(s) of the index file to look for. If true, looks for 'index.html'. + * Any falsy value disables index file lookup. Defaults to true. */ - path: string | string[] | hapi.RequestHandler; - /** index - optional boolean|string|string[], determines if an index file will be served if found in the folder when requesting a directory. The given string or strings specify the name(s) of the index file to look for. If true, looks for 'index.html'. Any falsy value disables index file lookup. Defaults to true. */ index?: boolean | string | string[]; - /** listing - optional boolean, determines if directory listing is generated when a directory is requested without an index document. Defaults to false. */ + /** + * listing - optional boolean, determines if directory listing is generated when a directory is requested without an index document. Defaults to false. + */ listing?: boolean; - /** showHidden - optional boolean, determines if hidden files will be shown and served. Defaults to false. */ + /** + * showHidden - optional boolean, determines if hidden files will be shown and served. Defaults to false. + */ showHidden?: boolean; - /** redirectToSlash - optional boolean, determines if requests for a directory without a trailing slash are redirected to the same path with the missing slash. Useful for ensuring relative links inside the response are resolved correctly. Disabled when the server config router.stripTrailingSlash is true.Defaults to false. */ + /** + * redirectToSlash - optional boolean, determines if requests for a directory without a trailing slash are redirected to the same path with the missing slash. + * Useful for ensuring relative links inside the response are resolved correctly. + * Disabled when the server config router.stripTrailingSlash is true.Defaults to false. + */ redirectToSlash?: boolean; - /** lookupCompressed - optional boolean, instructs the file processor to look for the same filename with the '.gz' suffix for a pre-compressed version of the file to serve if the request supports content encoding. Defaults to false. */ + /** + * lookupCompressed - optional boolean, instructs the file processor to look for the same filename with the '.gz' suffix for a pre-compressed + * version of the file to serve if the request supports content encoding. Defaults to false. + */ lookupCompressed?: boolean; /** * etagMethod - specifies the method used to calculate the ETag header response. Available values: @@ -65,7 +104,9 @@ declare namespace inert { * * false - Disable ETag computation. */ etagMethod?: 'hash' | 'simple' | false; - /** defaultExtension - optional string, appended to file requests if the requested file is not found. Defaults to no extension. */ + /** + * defaultExtension - optional string, appended to file requests if the requested file is not found. Defaults to no extension. + */ defaultExtension?: string; } @@ -81,8 +122,12 @@ declare namespace inert { } } +declare const inert: Plugin; + +export = inert; + declare module 'hapi' { - interface RouteHandlerPlugins { + interface RouteOptions { /** * The file handler * @@ -92,25 +137,33 @@ declare module 'hapi' { * * an object with one or more of the following options @see IFileHandler * @see {@link https://github.com/hapijs/inert#the-file-handler} */ - file?: string | RequestHandler | inert.FileHandlerRouteObject; + file?: string | inert.RequestHandler | inert.FileHandlerRouteObject; /** * The directory handler * - * Generates a directory endpoint for serving static content from a directory. Routes using the directory handler must include a path parameter at the end of the path string (e.g. /path/to/somewhere/{param} where the parameter name does not matter). The path parameter can use any of the parameter options (e.g. {param} for one level files only, {param?} for one level files or the directory root, {param*} for any level, or {param*3} for a specific level). If additional path parameters are present, they are ignored for the purpose of selecting the file system resource. The directory handler is an object with the following options: + * Generates a directory endpoint for serving static content from a directory. + * Routes using the directory handler must include a path parameter at the end of the path string + * (e.g. /path/to/somewhere/{param} where the parameter name does not matter). + * The path parameter can use any of the parameter options (e.g. {param} for one level files only, + * {param?} for one level files or the directory root, {param*} for any level, or {param*3} for a specific level). + * If additional path parameters are present, they are ignored for the purpose of selecting the file system resource. + * The directory handler is an object with the following options: * @see {@link https://github.com/hapijs/inert#the-directory-handler} */ directory?: inert.DirectoryHandlerRouteObject; + files?: { + /** + * Set the relative path + */ + relativeTo: string; + }; } - interface Base_Reply { + interface ResponseToolkit { /** * Transmits a file from the file system. The 'Content-Type' header defaults to the matching mime type based on filename extension. * @see {@link https://github.com/hapijs/inert#replyfilepath-options} */ - file: (path: string, options?: inert.ReplyFileHandlerOptions) => Response; + file(path: string, options?: inert.ReplyFileHandlerOptions): ResponseObject; } } - -declare var inert: hapi.PluginFunction; - -export = inert; diff --git a/types/inert/inert-tests.ts b/types/inert/inert-tests.ts index 9062e13f6b..b772a38259 100644 --- a/types/inert/inert-tests.ts +++ b/types/inert/inert-tests.ts @@ -1,130 +1,106 @@ -// Copied from: https://github.com/hapijs/inert#examples +import { + Server, + Lifecycle, +} from 'hapi'; -import Path = require('path'); -import Hapi = require('hapi'); -import Inert = require('inert'); +import * as path from 'path'; +import * as inert from 'inert'; -const server = new Hapi.Server({ - connections: { - routes: { - files: { - relativeTo: Path.join(__dirname, 'public') +const server = new Server({ + port: 3000, + routes: { + files: { + relativeTo: path.join(__dirname, 'public') + } + } +}); + +const provision = async () => { + await server.register(inert); + + await server.register({ + plugin: inert, + options: { etagsCacheMaxSize: 400 }, + }); + + await server.register({ + plugin: inert, + once: true, + }); + + server.route({ + method: 'GET', + path: '/{param*}', + handler: { + directory: { + path: '.', + redirectToSlash: true, + index: true } } - } -}); -server.connection({ port: 3000 }); + }); -server.register(Inert, () => {}); - -// added in addition to code from docs -const options: Inert.OptionalRegistrationOptions = {etagsCacheMaxSize: 400}; -server.register({ - register: Inert, - options, -}, (err) => {}); - -// added in addition to code from docs -server.register({ - register: Inert, - once: true, -}, (err) => {}); - -server.route({ - method: 'GET', - path: '/{param*}', - handler: { - directory: { - path: '.', - redirectToSlash: true, - index: true + // https://github.com/hapijs/inert#serving-a-single-file + server.route({ + method: 'GET', + path: '/{path*}', + handler: { + file: 'page.html' } - } -}); + }); -server.start((err) => { + // https://github.com/hapijs/inert#customized-file-response + server.route({ + method: 'GET', + path: '/file', + handler(request, reply) { + let path = 'plain.txt'; + if (request.headers['x-magic'] === 'sekret') { + path = 'awesome.png'; + } - if (err) { - throw err; - } + return reply.file(path).vary('x-magic'); + } + }); - console.log('Server running at:', server.info!.uri); -}); - -// https://github.com/hapijs/inert#serving-a-single-file - -server.route({ - method: 'GET', - path: '/{path*}', - handler: { - file: 'page.html' - } -}); - -// https://github.com/hapijs/inert#customized-file-response - -server.route({ - method: 'GET', - path: '/file', - handler: function (request, reply) { - - let path = 'plain.txt'; - if (request.headers['x-magic'] === 'sekret') { - path = 'awesome.png'; + const handler: Lifecycle.Method = (request, h) => { + const response = request.response; + if (response instanceof Error && response.output.statusCode === 404) { + return h.file('404.html').code(404); } - return reply.file(path).vary('x-magic'); - } -}); + return h.continue; + }; -const handler: Hapi.ServerExtRequestHandler = function (request, reply) { + server.ext('onPostHandler', handler); - const response = request.response!; - if (response.isBoom && - response.output!.statusCode === 404) { + const file: inert.FileHandlerRouteObject = { + path: '', + confine: true, + }; - return reply.file('404.html').code(404); - } + const directory: inert.DirectoryHandlerRouteObject = { + path: '', + listing: true + }; - return reply.continue(); -} - -server.ext('onPostHandler', handler); - -// additional code added in addition to doc example code - -var file: Inert.FileHandlerRouteObject = { - path: '', - confine: true, -}; -var directory: Inert.DirectoryHandlerRouteObject = { - path: '', - listing: true -}; - -file = { - path: '', - confine: true, -}; - -server.route({ - path: '', - method: 'GET', - handler: { - file, - directory: { - path: function(){ - if(Math.random() > 0.5) { - return ''; - } - else if(Math.random() > 0) { - return ['']; - } - return new Error(''); + server.route({ + path: '', + method: 'GET', + handler: { + file, + directory: { + path() { + if (Math.random() > 0.5) { + return ''; + } else if (Math.random() > 0) { + return ['']; + } + return new Error(''); + }, + BAD_listing: true, }, - BAD_listing: true, // TODO change typings to make this error }, - }, - config: { files: { relativeTo: __dirname } } -}) - + options: { files: { relativeTo: __dirname } } + }); +}; diff --git a/types/inert/tsconfig.json b/types/inert/tsconfig.json index c96c356741..866d1c4884 100644 --- a/types/inert/tsconfig.json +++ b/types/inert/tsconfig.json @@ -13,14 +13,6 @@ "../" ], "types": [], - "paths": { - "boom": [ - "boom/v4" - ], - "hapi": [ - "hapi/v16" - ] - }, "noEmit": true, "forceConsistentCasingInFileNames": true }, @@ -28,4 +20,4 @@ "index.d.ts", "inert-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/inert/tslint.json b/types/inert/tslint.json index a41bf5d19a..3db14f85ea 100644 --- a/types/inert/tslint.json +++ b/types/inert/tslint.json @@ -1,79 +1 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} +{ "extends": "dtslint/dt.json" } diff --git a/types/inert/v4/index.d.ts b/types/inert/v4/index.d.ts new file mode 100644 index 0000000000..e74d1a4ce9 --- /dev/null +++ b/types/inert/v4/index.d.ts @@ -0,0 +1,116 @@ +// Type definitions for inert 4.2 +// Project: https://github.com/hapijs/inert/ +// Definitions by: Steve Ognibene , AJP +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +import * as hapi from 'hapi'; + +declare namespace inert { + export interface ReplyFileHandlerOptions { + /** confine - serve file relative to this directory and returns 403 Forbidden if the path resolves outside the confine directory. Defaults to true which uses the relativeTo route option as the confine. Set to false to disable this security feature. */ + confine?: boolean; + /** filename - an optional filename to specify if sending a 'Content-Disposition' header, defaults to the basename of path */ + filename?: string; + /** + * mode - specifies whether to include the 'Content-Disposition' header with the response. Available values: + * * false - header is not included. This is the default value. + * * 'attachment' + * *'inline' + */ + mode?: false | 'attachment' | 'inline'; + /** lookupCompressed - if true, looks for for a pre-compressed version of the file with the same filename with an extension, depending on the accepted encoding. Defaults to false. */ + lookupCompressed?: boolean; + /** lookupMap - an object which maps content encoding to expected file name extension. Defaults to `{ gzip: '.gz' }. */ + lookupMap?: {[index: string]: string}; + /** + * etagMethod - specifies the method used to calculate the ETag header response. Available values: + * * 'hash' - SHA1 sum of the file contents, suitable for distributed deployments. Default value. + * * 'simple' - Hex encoded size and modification date, suitable when files are stored on a single server. + * * false - Disable ETag computation. + */ + etagMethod?: 'hash' | 'simple' | false; + /** start - offset in file to reading from, defaults to 0. */ + start?: number; + /** end - offset in file to stop reading from. If not set, will read to end of file. */ + end?: number; + } + + export interface FileHandlerRouteObject extends ReplyFileHandlerOptions { + /** path - a path string or function as described above (required). */ + path: string | hapi.RequestHandler; + } + + export interface DirectoryHandlerRouteObject { + /** path - (required) the directory root path (relative paths are resolved based on the route files configuration). Value can be: + * * a single path string used as the prefix for any resources requested by appending the request path parameter to the provided string. + * * an array of path strings. Each path will be attempted in order until a match is found (by following the same process as the single path string). + * * a function with the signature function(request) which returns the path string or an array of path strings. If the function returns an error, the error is passed back to the client in the response. + */ + path: string | string[] | hapi.RequestHandler; + /** index - optional boolean|string|string[], determines if an index file will be served if found in the folder when requesting a directory. The given string or strings specify the name(s) of the index file to look for. If true, looks for 'index.html'. Any falsy value disables index file lookup. Defaults to true. */ + index?: boolean | string | string[]; + /** listing - optional boolean, determines if directory listing is generated when a directory is requested without an index document. Defaults to false. */ + listing?: boolean; + /** showHidden - optional boolean, determines if hidden files will be shown and served. Defaults to false. */ + showHidden?: boolean; + /** redirectToSlash - optional boolean, determines if requests for a directory without a trailing slash are redirected to the same path with the missing slash. Useful for ensuring relative links inside the response are resolved correctly. Disabled when the server config router.stripTrailingSlash is true.Defaults to false. */ + redirectToSlash?: boolean; + /** lookupCompressed - optional boolean, instructs the file processor to look for the same filename with the '.gz' suffix for a pre-compressed version of the file to serve if the request supports content encoding. Defaults to false. */ + lookupCompressed?: boolean; + /** + * etagMethod - specifies the method used to calculate the ETag header response. Available values: + * * 'hash' - SHA1 sum of the file contents, suitable for distributed deployments. Default value. + * * 'simple' - Hex encoded size and modification date, suitable when files are stored on a single server. + * * false - Disable ETag computation. + */ + etagMethod?: 'hash' | 'simple' | false; + /** defaultExtension - optional string, appended to file requests if the requested file is not found. Defaults to no extension. */ + defaultExtension?: string; + } + + /** + * inert accepts the following registration options + * @see {@link https://github.com/hapijs/inert#registration-options} + */ + interface OptionalRegistrationOptions { + /** + * sets the maximum number of file etag hash values stored in the etags cache. Defaults to 10000. + */ + etagsCacheMaxSize?: number; + } +} + +declare module 'hapi' { + interface RouteHandlerPlugins { + /** + * The file handler + * + * Generates a static file endpoint for serving a single file. file can be set to: + * * a relative or absolute file path string (relative paths are resolved based on the route files configuration). + * * a function with the signature function(request) which returns the relative or absolute file path. + * * an object with one or more of the following options @see IFileHandler + * @see {@link https://github.com/hapijs/inert#the-file-handler} + */ + file?: string | RequestHandler | inert.FileHandlerRouteObject; + /** + * The directory handler + * + * Generates a directory endpoint for serving static content from a directory. Routes using the directory handler must include a path parameter at the end of the path string (e.g. /path/to/somewhere/{param} where the parameter name does not matter). The path parameter can use any of the parameter options (e.g. {param} for one level files only, {param?} for one level files or the directory root, {param*} for any level, or {param*3} for a specific level). If additional path parameters are present, they are ignored for the purpose of selecting the file system resource. The directory handler is an object with the following options: + * @see {@link https://github.com/hapijs/inert#the-directory-handler} + */ + directory?: inert.DirectoryHandlerRouteObject; + } + + interface Base_Reply { + /** + * Transmits a file from the file system. The 'Content-Type' header defaults to the matching mime type based on filename extension. + * @see {@link https://github.com/hapijs/inert#replyfilepath-options} + */ + file: (path: string, options?: inert.ReplyFileHandlerOptions) => Response; + } +} + +declare var inert: hapi.PluginFunction; + +export = inert; diff --git a/types/inert/v4/inert-tests.ts b/types/inert/v4/inert-tests.ts new file mode 100644 index 0000000000..9062e13f6b --- /dev/null +++ b/types/inert/v4/inert-tests.ts @@ -0,0 +1,130 @@ +// Copied from: https://github.com/hapijs/inert#examples + +import Path = require('path'); +import Hapi = require('hapi'); +import Inert = require('inert'); + +const server = new Hapi.Server({ + connections: { + routes: { + files: { + relativeTo: Path.join(__dirname, 'public') + } + } + } +}); +server.connection({ port: 3000 }); + +server.register(Inert, () => {}); + +// added in addition to code from docs +const options: Inert.OptionalRegistrationOptions = {etagsCacheMaxSize: 400}; +server.register({ + register: Inert, + options, +}, (err) => {}); + +// added in addition to code from docs +server.register({ + register: Inert, + once: true, +}, (err) => {}); + +server.route({ + method: 'GET', + path: '/{param*}', + handler: { + directory: { + path: '.', + redirectToSlash: true, + index: true + } + } +}); + +server.start((err) => { + + if (err) { + throw err; + } + + console.log('Server running at:', server.info!.uri); +}); + +// https://github.com/hapijs/inert#serving-a-single-file + +server.route({ + method: 'GET', + path: '/{path*}', + handler: { + file: 'page.html' + } +}); + +// https://github.com/hapijs/inert#customized-file-response + +server.route({ + method: 'GET', + path: '/file', + handler: function (request, reply) { + + let path = 'plain.txt'; + if (request.headers['x-magic'] === 'sekret') { + path = 'awesome.png'; + } + + return reply.file(path).vary('x-magic'); + } +}); + +const handler: Hapi.ServerExtRequestHandler = function (request, reply) { + + const response = request.response!; + if (response.isBoom && + response.output!.statusCode === 404) { + + return reply.file('404.html').code(404); + } + + return reply.continue(); +} + +server.ext('onPostHandler', handler); + +// additional code added in addition to doc example code + +var file: Inert.FileHandlerRouteObject = { + path: '', + confine: true, +}; +var directory: Inert.DirectoryHandlerRouteObject = { + path: '', + listing: true +}; + +file = { + path: '', + confine: true, +}; + +server.route({ + path: '', + method: 'GET', + handler: { + file, + directory: { + path: function(){ + if(Math.random() > 0.5) { + return ''; + } + else if(Math.random() > 0) { + return ['']; + } + return new Error(''); + }, + BAD_listing: true, // TODO change typings to make this error + }, + }, + config: { files: { relativeTo: __dirname } } +}) + diff --git a/types/inert/v4/tsconfig.json b/types/inert/v4/tsconfig.json new file mode 100644 index 0000000000..f742ec35d5 --- /dev/null +++ b/types/inert/v4/tsconfig.json @@ -0,0 +1,37 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "paths": { + "boom": [ + "boom/v4" + ], + "catbox": [ + "catbox/v7" + ], + "hapi": [ + "hapi/v16" + ], + "inert": [ + "inert/v4" + ] + }, + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "inert-tests.ts" + ] +} diff --git a/types/inert/v4/tslint.json b/types/inert/v4/tslint.json new file mode 100644 index 0000000000..a41bf5d19a --- /dev/null +++ b/types/inert/v4/tslint.json @@ -0,0 +1,79 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "adjacent-overload-signatures": false, + "array-type": false, + "arrow-return-shorthand": false, + "ban-types": false, + "callable-types": false, + "comment-format": false, + "dt-header": false, + "eofline": false, + "export-just-namespace": false, + "import-spacing": false, + "interface-name": false, + "interface-over-type-literal": false, + "jsdoc-format": false, + "max-line-length": false, + "member-access": false, + "new-parens": false, + "no-any-union": false, + "no-boolean-literal-compare": false, + "no-conditional-assignment": false, + "no-consecutive-blank-lines": false, + "no-construct": false, + "no-declare-current-package": false, + "no-duplicate-imports": false, + "no-duplicate-variable": false, + "no-empty-interface": false, + "no-for-in-array": false, + "no-inferrable-types": false, + "no-internal-module": false, + "no-irregular-whitespace": false, + "no-mergeable-namespace": false, + "no-misused-new": false, + "no-namespace": false, + "no-object-literal-type-assertion": false, + "no-padding": false, + "no-redundant-jsdoc": false, + "no-redundant-jsdoc-2": false, + "no-redundant-undefined": false, + "no-reference-import": false, + "no-relative-import-in-test": false, + "no-self-import": false, + "no-single-declare-module": false, + "no-string-throw": false, + "no-unnecessary-callback-wrapper": false, + "no-unnecessary-class": false, + "no-unnecessary-generics": false, + "no-unnecessary-qualifier": false, + "no-unnecessary-type-assertion": false, + "no-useless-files": false, + "no-var-keyword": false, + "no-var-requires": false, + "no-void-expression": false, + "no-trailing-whitespace": false, + "object-literal-key-quotes": false, + "object-literal-shorthand": false, + "one-line": false, + "one-variable-per-declaration": false, + "only-arrow-functions": false, + "prefer-conditional-expression": false, + "prefer-const": false, + "prefer-declare-function": false, + "prefer-for-of": false, + "prefer-method-signature": false, + "prefer-template": false, + "radix": false, + "semicolon": false, + "space-before-function-paren": false, + "space-within-parens": false, + "strict-export-declare-modifiers": false, + "trim-file": false, + "triple-equals": false, + "typedef-whitespace": false, + "unified-signatures": false, + "void-return": false, + "whitespace": false + } +} diff --git a/types/ipcheck/index.d.ts b/types/ipcheck/index.d.ts new file mode 100644 index 0000000000..2eca10280b --- /dev/null +++ b/types/ipcheck/index.d.ts @@ -0,0 +1,29 @@ +// Type definitions for ipcheck 0.1 +// Project: https://github.com/gosquared/ipcheck +// Definitions by: Ben Grynhaus +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +declare const ipcheck: ipcheck.IPCheckStatic; +export = ipcheck; +export as namespace ipcheck; + +declare namespace ipcheck { + interface IPCheck { + address: number[]; + input: string; + ipv: 4 | 6 | 0; + mask: number; + valid: boolean; + + match(cidr: IPCheck | string): boolean; + } + + interface IPCheckConstructor { + new (input: string): IPCheck; + } + + interface IPCheckStatic extends IPCheckConstructor { + match(ip: IPCheck | string, cidr: IPCheck | string): boolean; + } +} diff --git a/types/ipcheck/ipcheck-tests.ts b/types/ipcheck/ipcheck-tests.ts new file mode 100644 index 0000000000..e54d396652 --- /dev/null +++ b/types/ipcheck/ipcheck-tests.ts @@ -0,0 +1,19 @@ +import * as ipcheck from "ipcheck"; + +ipcheck.match(1, 1); // $ExpectError +ipcheck.match("", 1); // $ExpectError +ipcheck.match(1, ""); // $ExpectError + +new ipcheck(1); // $ExpectError + +const ip = new ipcheck(""); + +// $ExpectError +if (ip.ipv === 1) { +} + +// $ExpectError +if (ip.ipv === 1) { +} + +ip.match(1); // $ExpectError diff --git a/types/ipcheck/tsconfig.json b/types/ipcheck/tsconfig.json new file mode 100644 index 0000000000..18470e3333 --- /dev/null +++ b/types/ipcheck/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", "ipcheck-tests.ts"] +} diff --git a/types/ipcheck/tslint.json b/types/ipcheck/tslint.json new file mode 100644 index 0000000000..2c7c1bed53 --- /dev/null +++ b/types/ipcheck/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "interface-name": false + } +} diff --git a/types/jquery.appear/index.d.ts b/types/jquery.appear/index.d.ts new file mode 100644 index 0000000000..faa16b3a8f --- /dev/null +++ b/types/jquery.appear/index.d.ts @@ -0,0 +1,37 @@ +// Type definitions for JQuery Appear 1.0 +// Project: https://github.com/bas2k/jquery.appear +// Definitions by: Anderson Friaça +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +export interface Options { + /** + * Data to pass into callback + */ + data?: T; + + /** + * Callback is called only in first appear + */ + one?: boolean; + + /** + * X accuracy + */ + accX?: number; + + /** + * Y accuracy + */ + accY?: number; +} +declare global { + interface JQuery { + /** + * Initialize appear plugin + */ + appear(callback: ((element: HTMLElement, data: T) => void), options?: Options): JQuery; + } +} diff --git a/types/jquery.appear/jquery.appear-tests.ts b/types/jquery.appear/jquery.appear-tests.ts new file mode 100644 index 0000000000..ebd0e473d9 --- /dev/null +++ b/types/jquery.appear/jquery.appear-tests.ts @@ -0,0 +1,19 @@ +import { Options } from "jquery.appear"; + +$(document).ready(() => { + // basic usage + $('#foo').appear(() => { + $('#text').text('Appeared'); + }); + + // with options + const options: Options = { + data: 'test', + one: false, + accX: 50, + accY: 100 + }; + $('#foo').appear((element: HTMLElement, data: string) => { + $(element).text(data); + }, options); +}); diff --git a/types/jquery.appear/tsconfig.json b/types/jquery.appear/tsconfig.json new file mode 100644 index 0000000000..1c58b6e113 --- /dev/null +++ b/types/jquery.appear/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "jquery.appear-tests.ts" + ] +} \ No newline at end of file diff --git a/types/jquery.appear/tslint.json b/types/jquery.appear/tslint.json new file mode 100644 index 0000000000..d04fe2e1fa --- /dev/null +++ b/types/jquery.appear/tslint.json @@ -0,0 +1 @@ +{"extends": "dtslint/dt.json"} \ No newline at end of file diff --git a/types/jquery/v1/index.d.ts b/types/jquery/v1/index.d.ts index ee66781019..8cbc9c5789 100644 --- a/types/jquery/v1/index.d.ts +++ b/types/jquery/v1/index.d.ts @@ -1771,7 +1771,7 @@ interface JQuery { * Get the current coordinates of the first element in the set of matched elements, relative to the document. * @see {@link https://api.jquery.com/offset/#offset} */ - offset(): JQueryCoordinates; + offset(): JQueryCoordinates | undefined; /** * An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements. * diff --git a/types/jquery/v2/index.d.ts b/types/jquery/v2/index.d.ts index 9d30f12c38..2f9a79adf4 100644 --- a/types/jquery/v2/index.d.ts +++ b/types/jquery/v2/index.d.ts @@ -1771,7 +1771,7 @@ interface JQuery { * Get the current coordinates of the first element in the set of matched elements, relative to the document. * @see {@link https://api.jquery.com/offset/#offset} */ - offset(): JQueryCoordinates; + offset(): JQueryCoordinates | undefined; /** * An object containing the properties top and left, which are integers indicating the new top and left coordinates for the elements. * diff --git a/types/json-parse-better-errors/index.d.ts b/types/json-parse-better-errors/index.d.ts new file mode 100644 index 0000000000..5cf16c38e0 --- /dev/null +++ b/types/json-parse-better-errors/index.d.ts @@ -0,0 +1,18 @@ +// Type definitions for json-parse-better-errors 1.0 +// Project: https://github.com/zkat/json-parse-better-errors#readme +// Definitions by: Daniel Rosenwasser +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = json_parse_better_errors; + +/** + * Converts a JavaScript Object Notation (JSON) string into an object. + * @param text A valid JSON string. + * @param reviver A function that transforms the results. This function is called for each member of the object. + * If a member contains nested objects, the nested objects are transformed before the parent object is. + * @param context The number of characters to display in each direction around the position of an error. + */ +declare function json_parse_better_errors( + txt: string, + reviver?: (key: string, value: any) => any, + context?: number): any; diff --git a/types/json-parse-better-errors/json-parse-better-errors-tests.ts b/types/json-parse-better-errors/json-parse-better-errors-tests.ts new file mode 100644 index 0000000000..ec77a01fea --- /dev/null +++ b/types/json-parse-better-errors/json-parse-better-errors-tests.ts @@ -0,0 +1,11 @@ +import parseJson = require("json-parse-better-errors"); + +parseJson(`"hello"`); +parseJson(`trash`); +parseJson(`{ "a": {} }`, k => k.toLowerCase(), 20); +parseJson(`{ + "compilerOptions": { + + } +} +`, undefined, 40); diff --git a/types/json-parse-better-errors/tsconfig.json b/types/json-parse-better-errors/tsconfig.json new file mode 100644 index 0000000000..b7dda9071a --- /dev/null +++ b/types/json-parse-better-errors/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", + "json-parse-better-errors-tests.ts" + ] +} diff --git a/types/json-parse-better-errors/tslint.json b/types/json-parse-better-errors/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/json-parse-better-errors/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/jsontoxml/index.d.ts b/types/jsontoxml/index.d.ts new file mode 100644 index 0000000000..f683050031 --- /dev/null +++ b/types/jsontoxml/index.d.ts @@ -0,0 +1,22 @@ +// Type definitions for jsontoxml 1.0 +// Project: https://github.com/soldair/node-jsontoxml +// Definitions by: benstevens48 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace jsontoxml { + function escape(str: string): string; + function cdata(str: string): string; + interface JsonToXmlOptions { + escape?: boolean; + xmlHeader?: boolean | {standalone?: boolean}; + docType?: string; + prettyPrint?: boolean; + indent?: string; + removeIllegalNameCharacters?: boolean; + html?: boolean; + } +} + +declare function jsontoxml(data: any, options?: jsontoxml.JsonToXmlOptions): string; + +export = jsontoxml; diff --git a/types/jsontoxml/jsontoxml-tests.ts b/types/jsontoxml/jsontoxml-tests.ts new file mode 100644 index 0000000000..98b9da5552 --- /dev/null +++ b/types/jsontoxml/jsontoxml-tests.ts @@ -0,0 +1,10 @@ +import jsontoxml = require('jsontoxml'); + +// $ExpectType string +jsontoxml({foo: 'bar'}, {escape: true, xmlHeader: true}); + +// $ExpectType string +jsontoxml.escape('&test'); + +// $ExpectType string +jsontoxml.cdata('test'); diff --git a/types/jsontoxml/tsconfig.json b/types/jsontoxml/tsconfig.json new file mode 100644 index 0000000000..b69f2e8fd3 --- /dev/null +++ b/types/jsontoxml/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "esModuleInterop": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jsontoxml-tests.ts" + ] +} diff --git a/types/jsontoxml/tslint.json b/types/jsontoxml/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/jsontoxml/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/luxon/index.d.ts b/types/luxon/index.d.ts index fac0b90fe6..0d66b9750c 100644 --- a/types/luxon/index.d.ts +++ b/types/luxon/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/moment/luxon#readme // Definitions by: Colby DeHart // Hyeonseok Yang +// Jonathan Siebern // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -209,7 +210,7 @@ declare module 'luxon' { toSQLTime(options?: Object): string; toString(): string; toUTC(offset?: number, options?: ZoneOptions): DateTime; - until(other: DateTime): Duration; + until(other: DateTime): Interval; valueOf(): number; } diff --git a/types/maker.js/index.d.ts b/types/maker.js/index.d.ts index ff6a7bd69e..e8be054a36 100644 --- a/types/maker.js/index.d.ts +++ b/types/maker.js/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/Microsoft/maker.js // Definitions by: Dan Marshall // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// /// diff --git a/types/material-ui/index.d.ts b/types/material-ui/index.d.ts index c35eb31cba..cf8588d045 100644 --- a/types/material-ui/index.d.ts +++ b/types/material-ui/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for material-ui v0.20.0 +// Type definitions for material-ui 0.21 // Project: https://github.com/callemall/material-ui // Definitions by: Nathan Brown // Igor Beagorudsky @@ -519,7 +519,7 @@ declare namespace __MaterialUI { >(component: TComponent) => TComponent; export interface MuiThemeProviderProps { - muiTheme?: Styles.MuiTheme; + muiTheme?: MuiTheme; } export class MuiThemeProvider extends React.Component { } @@ -1051,6 +1051,8 @@ declare namespace __MaterialUI { open: boolean; overlayClassName?: string; overlayStyle?: React.CSSProperties; + paperClassName?: string; + paperProps?: any; repositionOnUpdate?: boolean; style?: React.CSSProperties; title?: React.ReactNode; @@ -1861,8 +1863,7 @@ declare namespace __MaterialUI { value?: any; disabled?: boolean; } - export class Tab extends React.Component< - TabProps, {}> { + export class Tab extends React.Component { } } diff --git a/types/material-ui/material-ui-tests.tsx b/types/material-ui/material-ui-tests.tsx index a997ca7512..a416670d0d 100644 --- a/types/material-ui/material-ui-tests.tsx +++ b/types/material-ui/material-ui-tests.tsx @@ -4754,7 +4754,7 @@ class DropDownMenuOpenImmediateExample extends Component<{}, {value?: number}> { } } -const DropDownMenuAnchorExample: React.SFC<{}> = () => ( +const DropDownMenuAnchorExample: React.SFC = () => ( , horiuchi , sindrenm , lukasz-zak , Alorel , jendrikw +// Definitions by: simonxca +// horiuchi +// sindrenm +// lukasz-zak +// Alorel +// jendrikw +// Ethan Resnick // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -2712,7 +2718,7 @@ declare module "mongoose" { * If this is a discriminator model, baseModelName is the * name of the base model. */ - baseModelName: String; + baseModelName: string | undefined; /** Collection the model uses. */ collection: Collection; diff --git a/types/mongoose/mongoose-tests.ts b/types/mongoose/mongoose-tests.ts index 80050dad33..bf2f61f4a3 100644 --- a/types/mongoose/mongoose-tests.ts +++ b/types/mongoose/mongoose-tests.ts @@ -1479,7 +1479,7 @@ MongoModel.update({ name: 'Tobi' }, { ferret: true }, { multi: true }, cb); MongoModel.where('age').gte(21).lte(65).exec(cb); MongoModel.where('age').gte(21).lte(65).where('name', /^b/i); new (mongoModel.base.model(''))(); -mongoModel.baseModelName.toLowerCase(); +mongoModel.baseModelName && mongoModel.baseModelName.toLowerCase(); mongoModel.collection.$format(99); mongoModel.collection.initializeOrderedBulkOp; mongoModel.collection.findOne; diff --git a/types/mongoose/v4/index.d.ts b/types/mongoose/v4/index.d.ts index 5f416b513a..4a4b7d224e 100644 --- a/types/mongoose/v4/index.d.ts +++ b/types/mongoose/v4/index.d.ts @@ -2730,7 +2730,7 @@ declare module "mongoose" { * If this is a discriminator model, baseModelName is the * name of the base model. */ - baseModelName: String; + baseModelName: string | undefined; /** Collection the model uses. */ collection: Collection; diff --git a/types/mongoose/v4/mongoose-tests.ts b/types/mongoose/v4/mongoose-tests.ts index 92adb61d83..64214fe983 100644 --- a/types/mongoose/v4/mongoose-tests.ts +++ b/types/mongoose/v4/mongoose-tests.ts @@ -1471,7 +1471,7 @@ MongoModel.update({ name: 'Tobi' }, { ferret: true }, { multi: true }, cb); MongoModel.where('age').gte(21).lte(65).exec(cb); MongoModel.where('age').gte(21).lte(65).where('name', /^b/i); new (mongoModel.base.model(''))(); -mongoModel.baseModelName.toLowerCase(); +mongoModel.baseModelName && mongoModel.baseModelName.toLowerCase(); mongoModel.collection.$format(99); mongoModel.collection.initializeOrderedBulkOp; mongoModel.collection.findOne; diff --git a/types/nes/tsconfig.json b/types/nes/tsconfig.json index 05fc49c647..18fc2712d8 100644 --- a/types/nes/tsconfig.json +++ b/types/nes/tsconfig.json @@ -13,11 +13,6 @@ "../" ], "types": [], - "paths": { - "boom": [ - "boom/v4" - ] - }, "noEmit": true, "forceConsistentCasingInFileNames": true }, diff --git a/types/nightmare/index.d.ts b/types/nightmare/index.d.ts index 737137f22e..061f22bd10 100644 --- a/types/nightmare/index.d.ts +++ b/types/nightmare/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/segmentio/nightmare // Definitions by: horiuchi // Sam Yang +// Bleser // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -132,6 +133,10 @@ declare class Nightmare { declare namespace Nightmare { export interface IConstructorOptions { timeout?: any; // number | string; + waitTimeout?:number //in ms + gotoTimeout?:number + pollInterval?:number + executionTimeout?:number interval?: any; // number | string; port?: number; weak?: boolean; diff --git a/types/nightmare/nightmare-tests.ts b/types/nightmare/nightmare-tests.ts index 1dfe655c94..7eb376b996 100644 --- a/types/nightmare/nightmare-tests.ts +++ b/types/nightmare/nightmare-tests.ts @@ -4,27 +4,27 @@ import Nightmare = require("nightmare"); new Nightmare() .goto('http://yahoo.com') - .type('input[title="Search"]', 'github nightmare') - .click('.searchsubmit') - .run((err: any, nightmare: Nightmare) => { - if (err) return console.log(err); - console.log('Done!'); - }); + .type('input[title="Search"]', 'github nightmare') + .click('.searchsubmit') + .run((err: any, nightmare: Nightmare) => { + if (err) return console.log(err); + console.log('Done!'); + }); new Nightmare() .goto('http://yahoo.com') - .type('input[title="Search"]', 'github nightmare') - .click('.searchsubmit') - .wait('.url.breadcrumb') - .evaluate(() => { - return (document.querySelector('.url.breadcrumb')).innerText; - }, (breadcrumb: string) => { - // expect(breadcrumb).to.equal('github.com'); - }) - .run((err: any, nightmare: Nightmare) => {}); + .type('input[title="Search"]', 'github nightmare') + .click('.searchsubmit') + .wait('.url.breadcrumb') + .evaluate(() => { + return (document.querySelector('.url.breadcrumb')).innerText; + }, (breadcrumb: string) => { + // expect(breadcrumb).to.equal('github.com'); + }) + .run((err: any, nightmare: Nightmare) => { }); -var done = (err: any) => {}; +var done = (err: any) => { }; new Nightmare() .goto('http://www.google.com/') @@ -141,7 +141,7 @@ new Nightmare() }; }, function (coordinates) { }) - .scrollTo(100,50) + .scrollTo(100, 50) .evaluate(function () { return { top: document.body.scrollTop, @@ -174,12 +174,12 @@ new Nightmare() new Nightmare() .goto('http://yahoo.com') - .screenshot('test/test.png', { x: 10, y: 5, width: 10, height: 10}) + .screenshot('test/test.png', { x: 10, y: 5, width: 10, height: 10 }) .run(done); new Nightmare() .goto('http://yahoo.com') - .screenshot({ x: 10, y: 5, width: 10, height: 10}, (err, buffer) => { + .screenshot({ x: 10, y: 5, width: 10, height: 10 }, (err, buffer) => { console.log(Buffer.isBuffer(buffer)); }) .run(done); @@ -197,7 +197,7 @@ new Nightmare() var seconds = function () { var gifs = document.querySelectorAll('img'); - var split = (gifs[gifs.length-2]).src.split('.gif')[0]; + var split = (gifs[gifs.length - 2]).src.split('.gif')[0]; var seconds = split.split('.com/c')[1]; return parseInt(seconds, 10); }; @@ -209,8 +209,8 @@ new Nightmare() var seconds = function () { var text = document.querySelectorAll('b')[0].textContent; var splits = text.split(/\s/); - var seconds = splits[splits.length-2].split(':')[2]; - return parseInt(seconds, 10)%10; + var seconds = splits[splits.length - 2].split(':')[2]; + return parseInt(seconds, 10) % 10; }; new Nightmare() .goto('http://www.whattimeisit.com/') @@ -218,8 +218,8 @@ new Nightmare() .run(done); new Nightmare({ - timeout: 1000 - }) + timeout: 1000 +}) .on('timeout', function (msg) { }) .goto('http://www.google.com/') @@ -262,15 +262,15 @@ new Nightmare() .run(done); new Nightmare() - .authentication('my','auth') + .authentication('my', 'auth') .goto('http://httpbin.org/basic-auth/my/auth') .evaluate(function () { return document.body.innerHTML; - }, function (data){ + }, function (data) { }) .run(done); -var size = { width : 400, height: 1000 }; +var size = { width: 400, height: 1000 }; new Nightmare() .viewport(size.width, size.height) .goto('http://www.wikipedia.org/') @@ -316,8 +316,8 @@ function search(term: string) { return function (nightmare: Nightmare) { nightmare .goto('http://yahoo.com') - .type('.input-query', term) - .click('.searchsubmit') + .type('.input-query', term) + .click('.searchsubmit') .wait(); }; } @@ -335,7 +335,7 @@ new Nightmare() .use(testTitle('test term')) .run(done); -new Nightmare({show: true}); +new Nightmare({ show: true }); new Nightmare() .goto('http://google.com', { bogus: 'foo' }) @@ -366,4 +366,28 @@ new Nightmare() .click('a[href="/segmentio/nightmare/archive/master.zip"]') .download('/some/other/path/master.zip'); -new Nightmare({show: true, openDevTools: {mode: 'detach'}}); +new Nightmare({ show: true, openDevTools: { mode: 'detach' } }); + + +new Nightmare({ waitTimeout: 1000 }) + .goto("https//google.com") + .wait(".really-not-real") + + +new Nightmare({ gotoTimeout: 10000 }) + .goto("https://45.56.178.93/") + + +new Nightmare({ executionTimeout: 1000 }) + .goto("https//google.com") + .evaluate(() => { + new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, 2000) + }) + }) + + + + diff --git a/types/openlayers/index.d.ts b/types/openlayers/index.d.ts index b7073bcda2..8a711771fa 100644 --- a/types/openlayers/index.d.ts +++ b/types/openlayers/index.d.ts @@ -14392,6 +14392,7 @@ declare module olx { angle?: number; snapToPixel?: boolean; stroke?: ol.style.Stroke; + rotation?: number; } diff --git a/types/opentype.js/index.d.ts b/types/opentype.js/index.d.ts index 24df752461..8dc449784d 100644 --- a/types/opentype.js/index.d.ts +++ b/types/opentype.js/index.d.ts @@ -1,66 +1,152 @@ -// Type definitions for opentype.js +// Type definitions for opentype.js 0.7 // Project: https://github.com/nodebox/opentype.js // Definitions by: Dan Marshall +// Edgar Simson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 export as namespace opentype; -interface Contour extends Array { -} - -export class Encoding { - charset: string; - charToGlyphIndex(c: string): number; - font: Font; -} - -interface Field { - name: string; - type: string; - value: any; -} +/****************************************** + * FONT + ******************************************/ export class Font { - private nametoGlyphIndex; - private supported; - constructor(options: FontOptions); + names: FontNames; + unitsPerEm: number; ascender: number; - cffEncoding: Encoding; + descender: number; + createdTimestamp: number; + tables: { [tableName: string]: Table }; + supported: boolean; + glyphs: GlyphSet; + encoding: Encoding; + substitution: Substitution; + + readonly defaultRenderOptions: RenderOptions; + + constructor(options: FontConstructorOptions); + charToGlyph(c: string): Glyph; charToGlyphIndex(s: string): number; - descender: number; - download(): void; - draw(ctx: CanvasRenderingContext2D, text: string, x: number, y: number, fontSize: number, options?: RenderOptions): void; - drawMetrics(ctx: CanvasRenderingContext2D, text: string, x: number, y: number, fontSize: number, options?: RenderOptions): void; - drawPoints(ctx: CanvasRenderingContext2D, text: string, x: number, y: number, fontSize: number, options?: RenderOptions): void; - encoding: Encoding; - forEachGlyph(text: string, x: number, y: number, fontSize: number, options: RenderOptions, callback: { (glyph: Glyph, x: number, y: number, fontSize: number, options?: RenderOptions): void; }): void; + download(fileName?: string): void; + draw( + ctx: CanvasRenderingContext2D, + text: string, + x?: number, + y?: number, + fontSize?: number, + options?: RenderOptions + ): void; + drawMetrics( + ctx: CanvasRenderingContext2D, + text: string, + x?: number, + y?: number, + fontSize?: number, + options?: RenderOptions + ): void; + drawPoints( + ctx: CanvasRenderingContext2D, + text: string, + x?: number, + y?: number, + fontSize?: number, + options?: RenderOptions + ): void; + forEachGlyph( + text: string, + x: number | undefined, + y: number | undefined, + fontSize: number | undefined, + options: RenderOptions | undefined, + callback: ( + glyph: Glyph, + x: number, + y: number, + fontSize: number, + options?: RenderOptions + ) => void + ): number; + getAdvanceWidth( + text: string, + fontSize?: number, + options?: RenderOptions + ): number; getEnglishName(name: string): string; - getGposKerningValue: { (leftGlyph: Glyph | number, rightGlyph: Glyph | number): number; }; - getKerningValue(leftGlyph: Glyph | number, rightGlyph: Glyph | number): number; - getPath(text: string, x: number, y: number, fontSize: number, options?: RenderOptions): Path; - getPaths(text: string, x: number, y: number, fontSize: number, options?: RenderOptions): Path[]; - glyphs: GlyphSet; + getKerningValue( + leftGlyph: Glyph | number, + rightGlyph: Glyph | number + ): number; + getPath( + text: string, + x: number, + y: number, + fontSize: number, + options?: RenderOptions + ): Path; + getPaths( + text: string, + x: number, + y: number, + fontSize: number, + options?: RenderOptions + ): Path[]; glyphIndexToName(gid: number): string; glyphNames: GlyphNames; hasChar(c: string): boolean; kerningPairs: KerningPairs; - names: FontNames; nameToGlyph(name: string): Glyph; nameToGlyphIndex(name: string): number; numberOfHMetrics: number; numGlyphs: number; outlinesFormat: string; stringToGlyphs(s: string): Glyph[]; - tables: { [tableName: string]: Table; }; toArrayBuffer(): ArrayBuffer; toBuffer(): ArrayBuffer; toTables(): Table; - unitsPerEm: number; validate(): void; } -interface FontNames { +export type FontConstructorOptions = FontConstructorOptionsBase & + Partial & { + glyphs: Glyph[]; + }; + +export interface FontOptions { + empty?: boolean; + familyName: string; + styleName: string; + fullName?: string; + postScriptName?: string; + designer?: string; + designerURL?: string; + manufacturer?: string; + manufacturerURL?: string; + license?: string; + licenseURL?: string; + version?: string; + description?: string; + copyright?: string; + trademark?: string; + unitsPerEm: number; + ascender: number; + descender: number; + createdTimestamp: number; + weightClass?: string; + widthClass?: string; + fsSelection?: string; +} + +export interface FontConstructorOptionsBase { + familyName: string; + styleName: string; + unitsPerEm: number; + ascender: number; + descender: number; +} + +export interface FontNames { copyright: LocalizedName; description: LocalizedName; designer: LocalizedName; @@ -77,28 +163,33 @@ interface FontNames { version: LocalizedName; } -interface FontOptions { - copyright?: string; - ascender?: number; - descender?: number; - description?: string; - designer?: string; - designerURL?: string; - empty?: boolean; - familyName?: string; - fullName?: string; - glyphs?: Glyph[] | GlyphSet; - license?: string; - licenseURL?: string; - manufacturer?: string; - manufacturerURL?: string; - postScriptName?: string; - styleName?: string; - unitsPerEm?: number; - trademark?: string; - version?: string; +export interface Table { + [propName: string]: any; + encode(): number[]; + fields: Field[]; + sizeOf(): number; + tables: Table[]; + tableName: string; } +export interface KerningPairs { + [pair: string]: number; +} + +export interface LocalizedName { + [lang: string]: string; +} + +export interface Field { + name: string; + type: string; + value: any; +} + +/****************************************** + * GLYPH + ******************************************/ + export class Glyph { private index; private xMin; @@ -106,23 +197,50 @@ export class Glyph { private yMin; private yMax; private points; - constructor(options: GlyphOptions); - addUnicode(unicode: number): void; - advanceWidth: number; - bindConstructorValues(options: GlyphOptions): void; - draw(ctx: CanvasRenderingContext2D, x: number, y: number, fontSize: number): void; - drawMetrics(ctx: CanvasRenderingContext2D, x: number, y: number, fontSize: number): void; - drawPoints(ctx: CanvasRenderingContext2D, x: number, y: number, fontSize: number): void; - getContours(): Contour[]; - getMetrics(): Metrics; - getPath(x: number, y: number, fontSize: number): Path; + name: string; - path: Path | { (): Path; }; + path: Path | (() => Path); unicode: number; unicodes: number[]; -} + advanceWidth: number; -interface GlyphOptions { + constructor(options: GlyphOptions); + + addUnicode(unicode: number): void; + bindConstructorValues(options: GlyphOptions): void; + draw( + ctx: CanvasRenderingContext2D, + x?: number, + y?: number, + fontSize?: number, + options?: RenderOptions + ): void; + drawMetrics( + ctx: CanvasRenderingContext2D, + x?: number, + y?: number, + fontSize?: number, + options?: RenderOptions + ): void; + drawPoints( + ctx: CanvasRenderingContext2D, + x?: number, + y?: number, + fontSize?: number, + options?: RenderOptions + ): void; + getBoundingBox(): BoundingBox; + getContours(): Contour; + getMetrics(): Metrics; + getPath( + x?: number, + y?: number, + fontSize?: number, + options?: RenderOptions, + font?: Font + ): Path; +} +export interface GlyphOptions { advanceWidth?: number; index?: number; font?: Font; @@ -146,71 +264,13 @@ export class GlyphNames { export class GlyphSet { private font; private glyphs; - constructor(font: Font, glyphs: Glyph[] | { (): Glyph; }[]); + constructor(font: Font, glyphs: Glyph[] | Array<(() => Glyph)>); get(index: number): Glyph; length: number; - push(index: number, loader: { (): Glyph; }): void; + push(index: number, loader: () => Glyph): void; } -interface KerningPairs { - [pair: string]: number; -} - -export function load(url: string, callback: { (error: any, font?: Font): void; }): void; - -export function loadSync(url: string): Font; - -interface LocalizedName { - [lang: string]: string; -} - -interface Metrics { - leftSideBearing: number; - rightSideBearing?: number; - xMax: number; - xMin: number; - yMax: number; - yMin: number; -} - -export function parse(buffer: any): Font; - -export class Path { - private fill; - private stroke; - private strokeWidth; - constructor(); - bezierCurveTo(x1: number, y1: number, x2: number, y2: number, x: number, y: number): void; - close: () => void; - closePath(): void; - commands: PathCommand[]; - curveTo: (x1: number, y1: number, x2: number, y2: number, x: number, y: number) => void; - draw(ctx: CanvasRenderingContext2D): void; - extend(pathOrCommands: Path | PathCommand[]): void; - lineTo(x: number, y: number): void; - moveTo(x: number, y: number): void; - quadraticCurveTo(x1: number, y1: number, x: number, y: number): void; - quadTo: (x1: number, y1: number, x: number, y: number) => void; - toPathData(decimalPlaces: number): string; - toSVG(decimalPlaces: number): string; - unitsPerEm: number; -} - -interface PathCommand { - type: string; - x?: number; - y?: number; - x1?: number; - y1?: number; - x2?: number; - y2?: number; -} - -interface Point { - lastPointOfContour?: boolean; -} - -interface Post { +export interface Post { glyphNameIndex?: number[]; isFixedPitch: number; italicAngle: number; @@ -226,15 +286,108 @@ interface Post { version: number; } -interface RenderOptions { - kerning: boolean; +export interface RenderOptions { + script?: string; + language?: string; + kerning?: boolean; + xScale?: number; + yScale?: number; + features?: { + [key: string]: boolean; + }; } -interface Table { - [propName: string]: any; - encode(): number[]; - fields: Field[]; - sizeOf(): number; - tables: Table[]; - tableName: string; +export interface Metrics { + leftSideBearing: number; + rightSideBearing?: number; + xMax: number; + xMin: number; + yMax: number; + yMin: number; } + +export interface Contour extends Array {} + +export interface Point { + lastPointOfContour?: boolean; +} + +/****************************************** + * PATH + ******************************************/ + +export class Path { + private fill; + private stroke; + private strokeWidth; + constructor(); + bezierCurveTo( + x1: number, + y1: number, + x2: number, + y2: number, + x: number, + y: number + ): void; + close: () => void; + closePath(): void; + commands: PathCommand[]; + curveTo: ( + x1: number, + y1: number, + x2: number, + y2: number, + x: number, + y: number + ) => void; + draw(ctx: CanvasRenderingContext2D): void; + extend(pathOrCommands: Path | PathCommand[] | BoundingBox): void; + getBoundingBox(): BoundingBox; + lineTo(x: number, y: number): void; + moveTo(x: number, y: number): void; + quadraticCurveTo(x1: number, y1: number, x: number, y: number): void; + quadTo: (x1: number, y1: number, x: number, y: number) => void; + toDOMElement(decimalPlaces: number): SVGPathElement; + toPathData(decimalPlaces: number): string; + toSVG(decimalPlaces: number): string; + unitsPerEm: number; +} + +export interface PathCommand { + type: string; + x?: number; + y?: number; + x1?: number; + y1?: number; + x2?: number; + y2?: number; +} + +/****************************************** + * UTIL CLASSES + ******************************************/ + +export type BoundingBox = () => any; +// TODO add methods + +export interface Encoding { + charset: string; + charToGlyphIndex(c: string): number; + font: Font; +} + +export type Substitution = (font: Font) => any; +// TODO add methods + +/****************************************** + * STATIC + ******************************************/ + +export function load( + url: string, + callback: (error: any, font?: Font) => void +): void; + +export function loadSync(url: string): Font; + +export function parse(buffer: any): Font; diff --git a/types/opentype.js/opentype.js-tests.ts b/types/opentype.js/opentype.js-tests.ts index e4b9942bd9..04781d5415 100644 --- a/types/opentype.js/opentype.js-tests.ts +++ b/types/opentype.js/opentype.js-tests.ts @@ -1,63 +1,119 @@ -var x = 0; -var y = 0; -var fontSize = 72; -var ctx: CanvasRenderingContext2D; +const x = 0; +const y = 0; +const fontSize = 72; +let ctx: CanvasRenderingContext2D; -opentype.load('fonts/Roboto-Black.ttf', function(err, font) { +opentype.load('fonts/Roboto-Black.ttf', (err, font) => { if (err) { - alert('Font could not be loaded: ' + err); + alert('Font could not be loaded: ' + err); } else { - var path = font.getPath('Hello, World!', 0, 150, 72); + const path = font.getPath('Hello, World!', 0, 150, 72); // If you just want to draw the text you can also use font.draw(ctx, text, x, y, fontSize). path.draw(ctx); } }); -var myBuffer: ArrayBuffer; -var font = opentype.parse(myBuffer); +let myBuffer: ArrayBuffer; +let font = opentype.parse(myBuffer); font = opentype.loadSync('fonts/Roboto-Black.ttf'); -var notdefGlyph = new opentype.Glyph({ +const notdefGlyph = new opentype.Glyph({ name: '.notdef', unicode: 0, advanceWidth: 650, path: new opentype.Path() }); -var aPath = new opentype.Path(); -aPath.moveTo(100, 0); -aPath.lineTo(100, 700); +const aPath = new opentype.Path(); // more drawing instructions... -var aGlyph = new opentype.Glyph({ +const aGlyph = new opentype.Glyph({ name: 'A', unicode: 65, advanceWidth: 650, path: aPath }); -var glyphs = [notdefGlyph, aGlyph]; -var font = new opentype.Font({ +const glyphs = [notdefGlyph, aGlyph]; +const fontGenerated = new opentype.Font({ familyName: 'OpenTypeSans', styleName: 'Medium', unitsPerEm: 1000, ascender: 800, descender: -200, - glyphs: glyphs}); + + glyphs +}); font.download(); -font.getPath('text', x, y, fontSize); -font.draw(ctx, 'text', x, y, fontSize); -font.drawPoints(ctx, 'text', x, y, fontSize); -font.drawMetrics(ctx, 'text', x, y, fontSize); -font.stringToGlyphs('string'); -font.charToGlyph('c'); -font.getKerningValue(notdefGlyph, aGlyph); +const hasChar: boolean = font.hasChar('a'); +const charIndex: number = font.charToGlyphIndex('a'); +const charGlyph: opentype.Glyph = font.charToGlyph('a'); +const charGlyphs: opentype.Glyph[] = font.stringToGlyphs('abc'); +const nameIndex: number = font.nameToGlyphIndex('a'); +const nameGlyph: opentype.Glyph = font.nameToGlyph('a'); +const indexName: string = font.glyphIndexToName(1); +const kerning: number = font.getKerningValue(notdefGlyph, aGlyph); +font.defaultRenderOptions.kerning = false; +const forEachWidth: number = font.forEachGlyph( + 'text', + x, + y, + fontSize, + { + kerning: true + }, + (glyph: opentype.Glyph, x: number, y: number, fontSize: number) => { + console.log({ + glyph, + x, + y, + fontSize + }); + } +); +const fontPath: opentype.Path = font.getPath('text', x, y, fontSize, {}); +const fontPaths: opentype.Path[] = font.getPaths('text', x, y, fontSize, {}); +const fontWidth: number = font.getAdvanceWidth('text', fontSize, { yScale: 0.5 }); +font.draw(ctx, 'text'); +font.drawPoints(ctx, 'text', x, y, fontSize, { yScale: 0.5 }); +font.drawMetrics(ctx, 'text', x, y, fontSize, { xScale: 1.1, yScale: 0.5 }); +const engName: string = font.getEnglishName('a'); +font.validate(); +const tables: opentype.Table = font.toTables(); +const ab: ArrayBuffer = font.toArrayBuffer(); +font.download(); +font.download('fileName.ttf'); -aGlyph.getPath(x, y, fontSize); -aGlyph.draw(ctx, x, y, fontSize); +aGlyph.bindConstructorValues({ advanceWidth: 1 }); +aGlyph.addUnicode(42); +const glyphBBox: opentype.BoundingBox = aGlyph.getBoundingBox(); +const glyphPathBasic: opentype.Path = aGlyph.getPath(); +const glyphPathFull: opentype.Path = aGlyph.getPath( + x, + y, + fontSize, + { xScale: 1, yScale: 2 }, + font +); +const glyphContours: opentype.Contour = aGlyph.getContours(); +const glyphMetrics: opentype.Metrics = aGlyph.getMetrics(); +aGlyph.draw(ctx, x, y, fontSize, {}); aGlyph.drawPoints(ctx, x, y, fontSize); aGlyph.drawMetrics(ctx, x, y, fontSize); +aPath.moveTo(100, 0); +aPath.lineTo(100, 700); +aPath.curveTo(100, 700, 200, 800, 150, 750); +aPath.bezierCurveTo(100, 700, 200, 800, 150, 750); +aPath.quadTo(100, 700, 200, 800); +aPath.quadraticCurveTo(100, 700, 200, 800); +aPath.close(); +aPath.closePath(); +aPath.extend(aPath); +aPath.extend(aPath.commands); +aPath.extend(aPath.getBoundingBox()); +const pathBBox: opentype.BoundingBox = aPath.getBoundingBox(); aPath.draw(ctx); -aPath.toPathData(7); -aPath.toSVG(7); +const pathData: string = aPath.toPathData(7); +const pathSvg: string = aPath.toSVG(7); +const pathDom: SVGPathElement = aPath.toDOMElement(7); diff --git a/types/opentype.js/tslint.json b/types/opentype.js/tslint.json index a41bf5d19a..f93cf8562a 100644 --- a/types/opentype.js/tslint.json +++ b/types/opentype.js/tslint.json @@ -1,79 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } + "extends": "dtslint/dt.json" } diff --git a/types/optics-agent/tsconfig.json b/types/optics-agent/tsconfig.json index 010406be2f..046bfaad81 100644 --- a/types/optics-agent/tsconfig.json +++ b/types/optics-agent/tsconfig.json @@ -13,11 +13,6 @@ "../" ], "types": [], - "paths": { - "boom": [ - "boom/v4" - ] - }, "noEmit": true, "forceConsistentCasingInFileNames": true }, diff --git a/types/ora/index.d.ts b/types/ora/index.d.ts index 05c4c9b460..f5dd605073 100644 --- a/types/ora/index.d.ts +++ b/types/ora/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Basarat Ali Syed // Christian Rackerseder // BendingBender +// Aleh Zasypkin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -118,14 +119,14 @@ declare class Ora { text: string; color: Color; - - promise(action: PromiseLike, options?: Options | string): Ora; } interface oraFactory { (options?: Options | string): Ora; new (options?: Options | string): Ora; + + promise(action: PromiseLike, options?: Options | string): Ora; } declare const ora: oraFactory; diff --git a/types/ora/ora-tests.ts b/types/ora/ora-tests.ts index ca5db9d70d..56a0d498c3 100644 --- a/types/ora/ora-tests.ts +++ b/types/ora/ora-tests.ts @@ -41,7 +41,7 @@ spinner.stopAndPersist({text: 'all done'}); spinner.stopAndPersist({symbol: '@', text: 'all done'}); const resolves = Promise.resolve(1); -spinner.promise(resolves, { +Ora.promise(resolves, { stream: new PassThrough(), text: 'foo', color: 'blue', diff --git a/types/parity-pmd/index.d.ts b/types/parity-pmd/index.d.ts new file mode 100644 index 0000000000..30b02d72ef --- /dev/null +++ b/types/parity-pmd/index.d.ts @@ -0,0 +1,27 @@ +// Type definitions for parity-pmd 0.4 +// Project: https://github.com/paritytrading/node-parity-pmd#readme +// Definitions by: Leonard Vujanić +// Vilim Stubičan +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +/// + +/** + * Declares Parity PMD message structure + * Full reference can be found here https://github.com/paritytrading/parity/blob/master/libraries/net/doc/PMD.md + */ +export interface PMDMessage { + messageType: string; + version?: string; + timestamp?: number; + orderNumber?: number; + side?: string; + instrument?: string; + quantity?: number; + price?: number; +} + +export function format(message: PMDMessage): Buffer; + +export function parse(buffer: Buffer): PMDMessage; diff --git a/types/parity-pmd/parity-pmd-tests.ts b/types/parity-pmd/parity-pmd-tests.ts new file mode 100644 index 0000000000..3645e7598c --- /dev/null +++ b/types/parity-pmd/parity-pmd-tests.ts @@ -0,0 +1,27 @@ +import { format, parse, PMDMessage } from 'parity-pmd'; + +// Arrange +const buffer = new Buffer(5); +buffer.writeUInt8(0x56, 0); +buffer.writeUInt32BE(70, 1); +const parsedContent: PMDMessage = parse(buffer); + +// Act & Assert +// $ExpectType PMDMessage +parse(buffer); + +// $ExpectType Buffer +format(parsedContent); + +// Invalid type +// $ExpectError +parse(''); + +// $ExpectError +format({}); + +// Invalid sub type +// $ExpectError +format({ + messageType: 1 +}); diff --git a/types/parity-pmd/tsconfig.json b/types/parity-pmd/tsconfig.json new file mode 100644 index 0000000000..92345f62fb --- /dev/null +++ b/types/parity-pmd/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", + "parity-pmd-tests.ts" + ] +} diff --git a/types/parity-pmd/tslint.json b/types/parity-pmd/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/parity-pmd/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/parity-pmr/index.d.ts b/types/parity-pmr/index.d.ts new file mode 100644 index 0000000000..0e05da1d6e --- /dev/null +++ b/types/parity-pmr/index.d.ts @@ -0,0 +1,30 @@ +// Type definitions for parity-pmr 0.1 +// Project: https://github.com/paritytrading/node-parity-pmr#readme +// Definitions by: Leo Vujanić +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +/** + * Declares Parity PMR message structure + * Full reference can be found here https://github.com/paritytrading/parity/blob/master/libraries/net/doc/PMR.md + */ +export interface PMRMessage { + messageType: string; + version?: number; + timestamp?: number; + username?: string; + orderNumber?: string; + side?: string; + instrument?: string; + quantity?: number; + price?: number; + canceledQuantity?: number; + matchNumber?: number; + restingOrderNumber?: number; + incomingOrderNumber?: number; +} + +export function format(message: PMRMessage): Buffer; + +export function parse(buffer: Buffer): PMRMessage; diff --git a/types/parity-pmr/parity-pmr-tests.ts b/types/parity-pmr/parity-pmr-tests.ts new file mode 100644 index 0000000000..03bcc3534d --- /dev/null +++ b/types/parity-pmr/parity-pmr-tests.ts @@ -0,0 +1,29 @@ +import { format, parse, PMRMessage } from "parity-pmr"; + +const buffer = new Buffer("test"); +const message: PMRMessage = { + messageType: 'E' +}; + +// $ExpectType Buffer +format(message); + +// Invalid type +// $ExpectError +format(''); + +// $ExpectError +format({}); + +// Invalid sub type +// $ExpectError +format({ + messageType: 1 +}); + +// $ExpectType PMRMessage +parse(buffer); + +// Invalid type +// $ExpectError +parse(''); diff --git a/types/parity-pmr/tsconfig.json b/types/parity-pmr/tsconfig.json new file mode 100644 index 0000000000..e73825b582 --- /dev/null +++ b/types/parity-pmr/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", + "parity-pmr-tests.ts" + ] +} diff --git a/types/parity-pmr/tslint.json b/types/parity-pmr/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/parity-pmr/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/parity-poe/index.d.ts b/types/parity-poe/index.d.ts new file mode 100644 index 0000000000..46ccf3291a --- /dev/null +++ b/types/parity-poe/index.d.ts @@ -0,0 +1,33 @@ +// Type definitions for Parity POE 0.3 +// Project: https://github.com/paritytrading/node-parity-poe +// Definitions by: Leo Vujanić +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +/// + +/** + * Declares Parity POE message structure + * Full reference can be found here https://github.com/paritytrading/parity/blob/master/libraries/net/doc/POE.md + */ +export interface POEMessage { + messageType: string; + orderId?: string; + timestamp?: number; + canceledQuantity?: number; + reason?: string; + liquidityFlag?: string; + matchNumber?: number; + side?: string; + instrument?: string; + quantity?: number; + price?: number; +} + +export function formatInbound(message: POEMessage): Buffer; + +export function parseInbound(buffer: Buffer): POEMessage; + +export function formatOutbound(message: POEMessage): Buffer; + +export function parseOutbound(buffer: Buffer): POEMessage; diff --git a/types/parity-poe/parity-poe-tests.ts b/types/parity-poe/parity-poe-tests.ts new file mode 100644 index 0000000000..c5b50d5189 --- /dev/null +++ b/types/parity-poe/parity-poe-tests.ts @@ -0,0 +1,68 @@ +import { formatInbound, parseInbound, formatOutbound, parseOutbound, POEMessage } from "parity-poe"; + +const buffer = new Buffer("test"); +const message: POEMessage = { + messageType: 'A' +}; + +/** + * formatInbound tests + */ + +// $ExpectType Buffer +formatInbound(message); + +// Invalid type +// $ExpectError +formatInbound(''); + +// $ExpectError +formatInbound({}); + +// Invalid sub type +// $ExpectError +formatInbound({ + messageType: 1 +}); + +/** + * parseInbound tests + */ + +// $ExpectType POEMessage +parseInbound(buffer); + +// Invalid type +// $ExpectError +parseInbound(''); + +/** + * formatOutbound tests + */ + +// $ExpectType Buffer +formatOutbound(message); + +// Invalid type +// $ExpectError +formatOutbound(''); + +// $ExpectError +formatOutbound({}); + +// Invalid sub type +// $ExpectError +formatOutbound({ + messageType: 1 +}); + +/** + * parseOutbound tests + */ + +// $ExpectType POEMessage +parseOutbound(buffer); + +// Invalid type +// $ExpectError +parseOutbound(''); diff --git a/types/parity-poe/tsconfig.json b/types/parity-poe/tsconfig.json new file mode 100644 index 0000000000..9dc0748761 --- /dev/null +++ b/types/parity-poe/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", + "parity-poe-tests.ts" + ] +} diff --git a/types/parity-poe/tslint.json b/types/parity-poe/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/parity-poe/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/parse/index.d.ts b/types/parse/index.d.ts index 95331fe0d7..9e91eb024d 100644 --- a/types/parse/index.d.ts +++ b/types/parse/index.d.ts @@ -891,7 +891,8 @@ declare namespace Parse { interface FunctionResponse { success: (response: any) => void; - error: (response: any) => void; + error (code: number, response: any): void; + error (response: any): void; } interface Cookie { @@ -912,7 +913,9 @@ declare namespace Parse { interface AfterDeleteRequest extends TriggerRequest { } interface BeforeDeleteRequest extends TriggerRequest { } interface BeforeDeleteResponse extends FunctionResponse { } - interface BeforeSaveRequest extends TriggerRequest { } + interface BeforeSaveRequest extends TriggerRequest { + original?: Parse.Object; + } interface BeforeSaveResponse extends FunctionResponse { success: () => void; } @@ -1147,4 +1150,4 @@ declare module "parse/node" { declare module "parse" { import * as parse from "parse/node"; export = parse -} +} \ No newline at end of file diff --git a/types/parse/parse-tests.ts b/types/parse/parse-tests.ts index b8d0d0dd0e..5063c1ae53 100644 --- a/types/parse/parse-tests.ts +++ b/types/parse/parse-tests.ts @@ -385,6 +385,27 @@ function test_cloud_functions() { // result }); + const CUSTOM_ERROR_INVALID_CONDITION = 1001 + const CUSTOM_ERROR_IMMUTABLE_FIELD = 1002 + + Parse.Cloud.beforeSave('MyCustomClass', (request: Parse.Cloud.BeforeSaveRequest, + response: Parse.Cloud.BeforeSaveResponse) => { + + if (request.object.isNew()) { + if (!request.object.has('immutable')) return response.error('Field immutable is required') + } else { + const original = request.original; + if (original == null) { // When the object is not new, request.original must be defined + return response.error(CUSTOM_ERROR_INVALID_CONDITION, 'Original must me defined for an existing object') + } + + if (original.get('immutable') !== request.object.get('immutable')) { + return response.error(CUSTOM_ERROR_IMMUTABLE_FIELD, 'This field cannot be changed') + } + } + response.success() + }); + Parse.Cloud.beforeFind('MyCustomClass', (request: Parse.Cloud.BeforeFindRequest) => { let query = request.query; // the Parse.Query let user = request.user; // the user diff --git a/types/playcanvas/engine/asset/asset-registry.d.ts b/types/playcanvas/engine/asset/asset-registry.d.ts index 47dede11a3..f4722ee490 100644 --- a/types/playcanvas/engine/asset/asset-registry.d.ts +++ b/types/playcanvas/engine/asset/asset-registry.d.ts @@ -166,4 +166,4 @@ declare namespace pc { */ find(name: string, type?: string): pc.Asset; } -} +} \ No newline at end of file diff --git a/types/playcanvas/engine/asset/asset.d.ts b/types/playcanvas/engine/asset/asset.d.ts index 3a5e514a6c..bfc51ff99f 100644 --- a/types/playcanvas/engine/asset/asset.d.ts +++ b/types/playcanvas/engine/asset/asset.d.ts @@ -1,5 +1,19 @@ declare namespace pc { + const ASSET_ANIMATION = 'animation'; + const ASSET_AUDIO = 'audio'; + const ASSET_IMAGE = 'image'; + const ASSET_JSON = 'json'; + const ASSET_MODEL = 'model'; + const ASSET_MATERIAL = 'material'; + const ASSET_TEXT = 'text'; + const ASSET_TEXTURE = 'texture'; + const ASSET_CUBEMAP = 'cubemap'; + const ASSET_SHADER = 'shader'; + const ASSET_CSS = 'css'; + const ASSET_HTML = 'html'; + const ASSET_SCRIPT = 'script'; + /** * @name pc.Asset * @class An asset record of a file or data resource that can be loaded by the engine. @@ -77,7 +91,7 @@ declare namespace pc { * }); * app.assets.load(asset); */ - ready(callback: (...args: any[]) => {}, scope: any): void; + ready(callback: (...args: any[]) => void, scope?: any): void; /** * @function @@ -106,7 +120,7 @@ declare namespace pc { * }); * obj.fire('test', 1, 2); // prints 3 to the console */ - on(name: string, callback: (...args: any[]) => void, scope: any): any; + on(name: string, callback: (...args: any[]) => void, scope?: any): any; /** * @function @@ -126,7 +140,7 @@ declare namespace pc { * obj.off('test', handler); // Removes all handler functions, called 'test' * obj.off('test', handler, this); // Removes all hander functions, called 'test' with scope this */ - off(name: string, callback: (...args: any[]) => void, scope: any): any; + off(name: string, callback: (...args: any[]) => void, scope?: any): any; /** * @function @@ -137,7 +151,7 @@ declare namespace pc { * @example * obj.fire('test', 'This is the message'); */ - fire(name: string, arg1: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any, arg6?: any, arg7?: any, arg8?: any): any; + fire(name: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any, arg6?: any, arg7?: any, arg8?: any): any; /** * @function @@ -153,7 +167,7 @@ declare namespace pc { * obj.fire('test', 1, 2); // prints 3 to the console * obj.fire('test', 1, 2); // not going to get handled */ - once(name: string, callback: (...args: any[]) => void, scope: any): any; + once(name: string, callback: (...args: any[]) => void, scope?: any): any; /** * @function diff --git a/types/playcanvas/engine/core/events.d.ts b/types/playcanvas/engine/core/events.d.ts index 21fc207840..7bf4f8b567 100644 --- a/types/playcanvas/engine/core/events.d.ts +++ b/types/playcanvas/engine/core/events.d.ts @@ -43,7 +43,7 @@ declare namespace pc { * }); * obj.fire('test', 1, 2); // prints 3 to the console */ - function on(name: string, callback: (...args: any[]) => void, scope: any): any; + function on(name: string, callback: (...args: any[]) => void, scope?: any): void; /** * @function @@ -63,7 +63,7 @@ declare namespace pc { * obj.off('test', handler); // Removes all handler functions, called 'test' * obj.off('test', handler, this); // Removes all hander functions, called 'test' with scope this */ - function off(name: string, callback: (...args: any[]) => void, scope: any): any; + function off(name: string, callback?: (...args: any[]) => void, scope?: any): void; /** * @function @@ -74,7 +74,7 @@ declare namespace pc { * @example * obj.fire('test', 'This is the message'); */ - function fire(name: string, arg1: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any, arg6?: any, arg7?: any, arg8?: any): any; + function fire(name: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any, arg6?: any, arg7?: any, arg8?: any): void; /** * @function @@ -90,7 +90,7 @@ declare namespace pc { * obj.fire('test', 1, 2); // prints 3 to the console * obj.fire('test', 1, 2); // not going to get handled */ - function once(name: string, callback: (...args: any[]) => void, scope: any): any; + function once(name: string, callback: (...args: any[]) => void, scope?: any): void; /** * @function diff --git a/types/playcanvas/engine/core/path.d.ts b/types/playcanvas/engine/core/path.d.ts index d6fa94abad..e94d8c7133 100644 --- a/types/playcanvas/engine/core/path.d.ts +++ b/types/playcanvas/engine/core/path.d.ts @@ -10,7 +10,7 @@ declare namespace pc { * The character that separates path segments * @name pc.path.delimiter */ - const delimiter = "/", + const delimiter = "/"; /** * Join two sections of file path together, insert a delimiter if needed. * @param {String} one First part of path to join diff --git a/types/playcanvas/engine/core/platform.d.ts b/types/playcanvas/engine/core/platform.d.ts index 15d1995415..f1522c2b90 100644 --- a/types/playcanvas/engine/core/platform.d.ts +++ b/types/playcanvas/engine/core/platform.d.ts @@ -1,5 +1,3 @@ -import { platform } from "os"; - declare namespace pc { /** diff --git a/types/playcanvas/engine/framework/application.d.ts b/types/playcanvas/engine/framework/application.d.ts index 404ce2e71f..6ef4d996d1 100644 --- a/types/playcanvas/engine/framework/application.d.ts +++ b/types/playcanvas/engine/framework/application.d.ts @@ -32,6 +32,8 @@ declare namespace pc { class Application { constructor(canvas: HTMLCanvasElement, options?: pc.ApplicationOptions) + static getApplication(id?: string): Application; + // PROPERTIES /** @@ -207,23 +209,23 @@ declare namespace pc { loadSceneSettings(url: string, callback: (...args: any[]) => {}): void; /** - * @function - * @name pc.Application#loadScene - * @description Load a scene file. - * @param {String} url The URL of the scene file. Usually this will be "scene_id.json" - * @param {Function} callback The function to call after loading, passed (err, entity) where err is null if no errors occurred. - * @example - * - * app.loadScene("1000.json", function (err, entity) { - * if (!err) { - * var e = app.root.find("My New Entity"); - * } else { - * // error - * } - * } - * }); - */ - loadScene(url: string, callback: (...args: any[]) => {}): void; + * @function + * @name pc.Application#loadScene + * @description Load a scene file. + * @param {String} url The URL of the scene file. Usually this will be "scene_id.json" + * @param {Function} callback The function to call after loading, passed (err, entity) where err is null if no errors occurred. + * @example + * + * app.loadScene("1000.json", function (err, entity) { + * if (!err) { + * var e = app.root.find("My New Entity"); + * } else { + * // error + * } + * } + * }); + */ + loadScene(url: string, callback: (...args: any[]) => {}): void; /** * @function @@ -497,7 +499,7 @@ declare namespace pc { * @example * obj.fire('test', 'This is the message'); */ - fire(name: string, arg1: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any, arg6?: any, arg7?: any, arg8?: any): any; + fire(name: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any, arg6?: any, arg7?: any, arg8?: any): any; /** * @function diff --git a/types/playcanvas/engine/framework/components/animation/component.d.ts b/types/playcanvas/engine/framework/components/animation/component.d.ts index 5060499b3d..ca0547b6fe 100644 --- a/types/playcanvas/engine/framework/components/animation/component.d.ts +++ b/types/playcanvas/engine/framework/components/animation/component.d.ts @@ -20,9 +20,14 @@ declare namespace pc { speed: number; loop: boolean; activate: boolean; - assets: pc.Asset[]; + assets: number[]; currentTime: number; duration: number; + playing: boolean; + currAnim: string; + + animations: any; + animationsIndex: any; /** * @function @@ -32,7 +37,7 @@ declare namespace pc { * @param {Number} [blendTime] The time in seconds to blend from the current * animation state to the start of the animation being set. */ - play(name: string, blendTime: number): void; + play(name: string, blendTime?: number): void; /** * @function diff --git a/types/playcanvas/engine/framework/components/component.d.ts b/types/playcanvas/engine/framework/components/component.d.ts index 5b47908106..113c5e6e80 100644 --- a/types/playcanvas/engine/framework/components/component.d.ts +++ b/types/playcanvas/engine/framework/components/component.d.ts @@ -41,7 +41,7 @@ declare namespace pc { * }); * obj.fire('test', 1, 2); // prints 3 to the console */ - on(name: string, callback: (...args: any[]) => void, scope: any): any; + on(name: string, callback: (...args: any[]) => void, scope?: any): void; /** * @function @@ -61,7 +61,7 @@ declare namespace pc { * obj.off('test', handler); // Removes all handler functions, called 'test' * obj.off('test', handler, this); // Removes all hander functions, called 'test' with scope this */ - off(name: string, callback: (...args: any[]) => void, scope: any): any; + off(name: string, callback?: (...args: any[]) => void, scope?: any): void; /** * @function @@ -72,7 +72,7 @@ declare namespace pc { * @example * obj.fire('test', 'This is the message'); */ - fire(name: string, arg1: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any, arg6?: any, arg7?: any, arg8?: any): any; + fire(name: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any, arg6?: any, arg7?: any, arg8?: any): void; /** * @function @@ -88,7 +88,7 @@ declare namespace pc { * obj.fire('test', 1, 2); // prints 3 to the console * obj.fire('test', 1, 2); // not going to get handled */ - once(name: string, callback: (...args: any[]) => void, scope: any): any; + once(name: string, callback: (...args: any[]) => void, scope?: any): void; /** * @function diff --git a/types/playcanvas/engine/framework/components/model/component.d.ts b/types/playcanvas/engine/framework/components/model/component.d.ts index b89d52721c..c6f5679dd3 100644 --- a/types/playcanvas/engine/framework/components/model/component.d.ts +++ b/types/playcanvas/engine/framework/components/model/component.d.ts @@ -34,7 +34,7 @@ declare namespace pc { constructor(system: pc.ModelComponentSystem, entity: pc.Entity) type: string; - asset: pc.Asset; + asset: pc.Asset | number; castShadows: boolean; receiveShadows: boolean; materialAsset: number; diff --git a/types/playcanvas/engine/framework/components/script/component.d.ts b/types/playcanvas/engine/framework/components/script/component.d.ts index dbaf70b569..1084b904ef 100644 --- a/types/playcanvas/engine/framework/components/script/component.d.ts +++ b/types/playcanvas/engine/framework/components/script/component.d.ts @@ -70,5 +70,7 @@ declare namespace pc { * entity.script.move('playerController', 0); */ move(name: string, ind: number): boolean; + + [prop: string]: any; } } diff --git a/types/playcanvas/engine/framework/components/sound/component.d.ts b/types/playcanvas/engine/framework/components/sound/component.d.ts index 0363d61a8f..d5be560773 100644 --- a/types/playcanvas/engine/framework/components/sound/component.d.ts +++ b/types/playcanvas/engine/framework/components/sound/component.d.ts @@ -87,7 +87,7 @@ declare namespace pc { * this.entity.sound.slot('beep').volume = 0.5; * */ - slot(name: string): pc.Slot; + slot(name: string): pc.SoundSlot; /** * @function diff --git a/types/playcanvas/engine/framework/entity.d.ts b/types/playcanvas/engine/framework/entity.d.ts index 0b1f12ae55..4fd31d0013 100644 --- a/types/playcanvas/engine/framework/entity.d.ts +++ b/types/playcanvas/engine/framework/entity.d.ts @@ -54,6 +54,8 @@ declare namespace pc { constructor(name?: string, app?: pc.Application) constructor(app?: pc.Application) + private _app: pc.Application; + /** * @function * @name pc.Entity#addComponent @@ -102,13 +104,12 @@ declare namespace pc { removeComponent(type: pc.ComponentTypes): void; /** - * @private * @function * @name pc.Entity#getGuid * @description Get the GUID value for this Entity * @returns {String} The GUID of the Entity */ - private getGuid(): string; + public getGuid(): string; /** * @private diff --git a/types/playcanvas/engine/graphics/device.d.ts b/types/playcanvas/engine/graphics/device.d.ts index 188de0b1a3..fc0be6df09 100644 --- a/types/playcanvas/engine/graphics/device.d.ts +++ b/types/playcanvas/engine/graphics/device.d.ts @@ -45,6 +45,10 @@ declare namespace pc { */ readonly maxVolumeSize: number; + readonly canvas: HTMLCanvasElement; + + maxPixelRatio: number; + /** * @function * @name pc.GraphicsDevice#setViewport @@ -68,13 +72,13 @@ declare namespace pc { setScissor(x: number, y: number, w: number, h: number): void; /** - * @private + * @public * @function * @name pc.GraphicsDevice#getProgramLibrary * @description Retrieves the program library assigned to the specified graphics device. * @returns {pc.ProgramLibrary} The program library assigned to the device. */ - private getProgramLibrary(): pc.ProgramLibrary; + getProgramLibrary(): pc.ProgramLibrary; /** * @private diff --git a/types/playcanvas/engine/graphics/texture.d.ts b/types/playcanvas/engine/graphics/texture.d.ts index ac637117bf..ed468ba5e6 100644 --- a/types/playcanvas/engine/graphics/texture.d.ts +++ b/types/playcanvas/engine/graphics/texture.d.ts @@ -85,7 +85,7 @@ declare namespace pc { * @author Will Eastcott */ class Texture { - constructor(graphicsDevice: pc.GraphicsDevice, options: { + constructor(graphicsDevice: pc.GraphicsDevice, options?: { width: number, height: number, depth: number, @@ -95,6 +95,7 @@ declare namespace pc { anisotropy: number, addressU: number, addressV: number, + addressW: number, mipmaps: boolean, cubemap: boolean, volume: boolean, diff --git a/types/playcanvas/engine/graphics/vertex-format.d.ts b/types/playcanvas/engine/graphics/vertex-format.d.ts index 13052e2a8a..f787f3a448 100644 --- a/types/playcanvas/engine/graphics/vertex-format.d.ts +++ b/types/playcanvas/engine/graphics/vertex-format.d.ts @@ -58,10 +58,10 @@ declare namespace pc { */ class VertexFormat { constructor(graphicsDevice: pc.GraphicsDevice, description: { - semantic: number, + semantic: string, components: number, type: number, - normalize: boolean + normalize?: boolean }[]) } } \ No newline at end of file diff --git a/types/playcanvas/engine/graphics/vertex-iterator.d.ts b/types/playcanvas/engine/graphics/vertex-iterator.d.ts index bc9b23d59b..8f56ff6b87 100644 --- a/types/playcanvas/engine/graphics/vertex-iterator.d.ts +++ b/types/playcanvas/engine/graphics/vertex-iterator.d.ts @@ -10,6 +10,8 @@ declare namespace pc { class VertexIterator { constructor(vertexBuffer: pc.VertexBuffer) + element: any; + /** * @function * @name pc.VertexIterator#next diff --git a/types/playcanvas/engine/input/input.d.ts b/types/playcanvas/engine/input/input.d.ts index d132539b36..97f51d4158 100644 --- a/types/playcanvas/engine/input/input.d.ts +++ b/types/playcanvas/engine/input/input.d.ts @@ -41,19 +41,19 @@ declare namespace pc { * @name pc.EVENT_TOUCHSTART * @description Name of event fired when a new touch occurs. For example, a finger is placed on the device. */ - const VENT_TOUCHSTART = 'touchstart'; + const EVENT_TOUCHSTART = 'touchstart'; /** * @enum pc.EVENT * @name pc.EVENT_TOUCHEND * @description Name of event fired when touch ends. For example, a finger is lifted off the device. */ - const VENT_TOUCHEND = 'touchend'; + const EVENT_TOUCHEND = 'touchend'; /** * @enum pc.EVENT * @name pc.EVENT_TOUCHMOVE * @description Name of event fired when a touch moves. */ - const VENT_TOUCHMOVE = 'touchmove'; + const EVENT_TOUCHMOVE = 'touchmove'; /** * @enum pc.EVENT * @name pc.EVENT_TOUCHCANCEL @@ -62,18 +62,18 @@ declare namespace pc { * For example, a modal alert pops up during the interaction; the touch point leaves the document area; * or there are more touch points than the device supports, in which case the earliest touch point is canceled. */ - const VENT_TOUCHCANCEL = 'touchcancel'; + const EVENT_TOUCHCANCEL = 'touchcancel'; /** * @enum pc.KEY * @name pc.KEY_BACKSPACE */ - const EY_BACKSPACE = 8; + const KEY_BACKSPACE = 8; /** * @enum pc.KEY * @name pc.KEY_TAB */ - const EY_TAB = 9; + const KEY_TAB = 9; /** * @enum pc.KEY * @name pc.KEY_RETURN diff --git a/types/playcanvas/engine/input/mouse.d.ts b/types/playcanvas/engine/input/mouse.d.ts index 524e2c40c6..a614d57d15 100644 --- a/types/playcanvas/engine/input/mouse.d.ts +++ b/types/playcanvas/engine/input/mouse.d.ts @@ -1,4 +1,4 @@ -type BrowserMouseEvent = typeof MouseEvent; +type BrowserMouseEvent = MouseEvent; declare namespace pc { /** @@ -45,16 +45,15 @@ declare namespace pc { * @param {Element} [element] The Element that the mouse events are attached to */ class Mouse { - constructor(element?: Element) - /** * @function * @name pc.Mouse.isPointerLocked * @description Check if the mouse pointer has been locked, using {@link pc.Mouse#enabledPointerLock} * @returns {Boolean} True if locked */ - isPointerLocked(): void; + static isPointerLocked(): void; + constructor(element?: Element) /** * @function diff --git a/types/playcanvas/engine/input/touch.d.ts b/types/playcanvas/engine/input/touch.d.ts index d94f8167b7..bc56e87894 100644 --- a/types/playcanvas/engine/input/touch.d.ts +++ b/types/playcanvas/engine/input/touch.d.ts @@ -1,5 +1,5 @@ -type BrowserTouchEvent = typeof TouchEvent; -type BrowserTouch = typeof Touch; +type BrowserTouchEvent = TouchEvent; +type BrowserTouch = Touch; declare namespace pc { @@ -18,6 +18,7 @@ declare namespace pc { constructor(device: pc.TouchDevice, event: BrowserTouchEvent) element: Element; + event: BrowserTouchEvent; touches: pc.Touch[]; changedTouches: pc.Touch[]; @@ -166,4 +167,4 @@ declare namespace pc { */ hasEvent(name: string): boolean; } -} \ No newline at end of file +} diff --git a/types/playcanvas/engine/math/mat3.d.ts b/types/playcanvas/engine/math/mat3.d.ts index d84f39d124..1ed5afed3e 100644 --- a/types/playcanvas/engine/math/mat3.d.ts +++ b/types/playcanvas/engine/math/mat3.d.ts @@ -15,6 +15,8 @@ declare namespace pc { * @param {Number} [v8] The value in row 2, column 2. */ class Mat3 { + data: Float32Array; + constructor(v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number) constructor(v0: [number, number, number, number, number, number, number, number, number]) diff --git a/types/playcanvas/engine/math/mat4.d.ts b/types/playcanvas/engine/math/mat4.d.ts index 73306d52c7..d6fb0e75e9 100644 --- a/types/playcanvas/engine/math/mat4.d.ts +++ b/types/playcanvas/engine/math/mat4.d.ts @@ -22,6 +22,8 @@ declare namespace pc { * @param {Number} [v15] The value in row 3, column 3. */ class Mat4 { + data: Float32Array; + constructor( v0: number, v1: number, v2: number, v3: number, v4: number, v5: number, v6: number, v7: number, v8: number, v9: number, v10: number, v11: number, v12: number, v13: number, v14: number, v15: number diff --git a/types/playcanvas/engine/math/vec2.d.ts b/types/playcanvas/engine/math/vec2.d.ts index ec02347f46..2fc8bef234 100644 --- a/types/playcanvas/engine/math/vec2.d.ts +++ b/types/playcanvas/engine/math/vec2.d.ts @@ -8,7 +8,10 @@ declare namespace pc { * @param {Number} [y] The y value */ class Vec2 { - constructor(x: number, y: number) + data: Float32Array; + + constructor(x: number, y: number); + constructor(); /** * @function diff --git a/types/playcanvas/engine/math/vec3.d.ts b/types/playcanvas/engine/math/vec3.d.ts index cc298d6a4e..30ea7a5758 100644 --- a/types/playcanvas/engine/math/vec3.d.ts +++ b/types/playcanvas/engine/math/vec3.d.ts @@ -10,6 +10,7 @@ declare namespace pc { * var v = new pc.Vec3(1,2,3); */ class Vec3 { + data: Float32Array; constructor(x: number, y: number, z: number) constructor(x: [number, number, number]) diff --git a/types/playcanvas/engine/math/vec4.d.ts b/types/playcanvas/engine/math/vec4.d.ts index f562eeb6bc..919c65f56c 100644 --- a/types/playcanvas/engine/math/vec4.d.ts +++ b/types/playcanvas/engine/math/vec4.d.ts @@ -10,6 +10,8 @@ declare namespace pc { * @param {Number} [w] The w value */ class Vec4 { + data: Float32Array; + constructor(x: number, y: number, z: number, w: number) constructor(x: [number, number, number, number]) constructor(); diff --git a/types/playcanvas/engine/resources/animation.d.ts b/types/playcanvas/engine/resources/animation.d.ts new file mode 100644 index 0000000000..18a51950c4 --- /dev/null +++ b/types/playcanvas/engine/resources/animation.d.ts @@ -0,0 +1,7 @@ +declare namespace pc { + class AnimationHandler { + load(url: string, callback: Function): void; + open(url: string, data: any): any; + patch(asset: pc.Asset, assets: pc.AssetRegistry): void; + } +} diff --git a/types/playcanvas/engine/resources/cubemap.d.ts b/types/playcanvas/engine/resources/cubemap.d.ts new file mode 100644 index 0000000000..157f62c456 --- /dev/null +++ b/types/playcanvas/engine/resources/cubemap.d.ts @@ -0,0 +1,7 @@ +declare namespace pc { + class CubemapHandler { + load(url: string, callback: Function): void; + open(url: string, data: any): any; + patch(asset: pc.Asset, assets: pc.AssetRegistry): void; + } +} diff --git a/types/playcanvas/engine/resources/loader.d.ts b/types/playcanvas/engine/resources/loader.d.ts index 61e99b179a..632886242f 100644 --- a/types/playcanvas/engine/resources/loader.d.ts +++ b/types/playcanvas/engine/resources/loader.d.ts @@ -1,8 +1,9 @@ declare namespace pc { interface ResourceHandler { - load: (url: 'string', callback: (...args: any[]) => {}) => {}; - open: (url: 'string', date: any) => {}; + load(url: 'string', callback: (...args: any[]) => {}): void; + open(url: 'string', data: any): any; + patch(asset: pc.Asset, assets: pc.AssetRegistry): void; } /** @@ -25,6 +26,11 @@ declare namespace pc { */ addHandler(type: string, handler: pc.ResourceHandler): void; + getHandler(type: string): any; + + removeHandler(type: string): void; + + /** * @function * @name pc.ResourceLoader#load diff --git a/types/playcanvas/engine/resources/material.d.ts b/types/playcanvas/engine/resources/material.d.ts new file mode 100644 index 0000000000..7259655759 --- /dev/null +++ b/types/playcanvas/engine/resources/material.d.ts @@ -0,0 +1,10 @@ +declare namespace pc { + + function getMaterialParamType(name: string): string; + + class MaterialHandler { + load(url: string, callback: Function): void; + open(url: string, data: any): void; + patch(asset: pc.Asset, assets: pc.AssetRegistry): void; + } +} diff --git a/types/playcanvas/engine/resources/model.d.ts b/types/playcanvas/engine/resources/model.d.ts index a5d7dbd8e7..116c83c6ac 100644 --- a/types/playcanvas/engine/resources/model.d.ts +++ b/types/playcanvas/engine/resources/model.d.ts @@ -7,6 +7,9 @@ declare namespace pc { * @param {pc.GraphicsDevice} device The graphics device that will be rendering */ class ModelHandler { + + static DEFAULT_MATERIAL: pc.StandardMaterial; + constructor(device: pc.GraphicsDevice) /** diff --git a/types/playcanvas/engine/resources/script.d.ts b/types/playcanvas/engine/resources/script.d.ts index 3f7fd26292..2299dfc3e9 100644 --- a/types/playcanvas/engine/resources/script.d.ts +++ b/types/playcanvas/engine/resources/script.d.ts @@ -8,7 +8,11 @@ declare namespace pc { * @param {pc.Application} app The running {pc.Application} */ class ScriptHandler { - constructor(app: pc.Application) + static _push(Type: ScriptType): void; + constructor(app: pc.Application) + load(url: string, callback: Function): void; + open(url: string, data: any): any; + patch(asset: pc.Asset, assets: pc.AssetRegistry): void; } } diff --git a/types/playcanvas/engine/resources/texture.d.ts b/types/playcanvas/engine/resources/texture.d.ts new file mode 100644 index 0000000000..d5073290e6 --- /dev/null +++ b/types/playcanvas/engine/resources/texture.d.ts @@ -0,0 +1,9 @@ +declare namespace pc { + class TextureHandler { + crossOrigin: boolean | string; + + load(url: string, callback: Function): void; + open(url: string, data: any): any; + patch(asset: pc.Asset, assets: pc.AssetRegistry): void; + } +} diff --git a/types/playcanvas/engine/scene/basic-material.d.ts b/types/playcanvas/engine/scene/basic-material.d.ts index 6bca34dfd5..f6c4404b39 100644 --- a/types/playcanvas/engine/scene/basic-material.d.ts +++ b/types/playcanvas/engine/scene/basic-material.d.ts @@ -23,6 +23,9 @@ declare namespace pc { */ class BasicMaterial extends pc.Material { + color: pc.Color; + colorMap: pc.Texture; + /** * @function * @name pc.BasicMaterial#clone diff --git a/types/playcanvas/engine/scene/graph-node.d.ts b/types/playcanvas/engine/scene/graph-node.d.ts index f9d587f8af..b5baf6579b 100644 --- a/types/playcanvas/engine/scene/graph-node.d.ts +++ b/types/playcanvas/engine/scene/graph-node.d.ts @@ -8,6 +8,8 @@ declare namespace pc { */ class GraphNode { constructor(name?: string) + name: string; + tags: pc.Tags; /** * @readonly @@ -64,7 +66,7 @@ declare namespace pc { * @type pc.GraphNode[] * @description A read-only property to get the children of this graph node. */ - readonly children: pc.GraphNode; + readonly children: pc.GraphNode[]; /** * @function @@ -378,6 +380,7 @@ declare namespace pc { * this.entity.setLocalEulerAngles(0, 90, 0); // Set rotation of 90 degrees around y-axis. */ setLocalEulerAngles(x: number, y: number, z: number): void; + setLocalEulerAngles(...args: number[]): void; /** * @function @@ -402,6 +405,7 @@ declare namespace pc { * this.entity.setLocalPosition(0, 10, 0); */ setLocalPosition(x: number, y: number, z: number): void; + setLocalPosition(...args: number[]): void; /** * @function @@ -437,6 +441,7 @@ declare namespace pc { * this.entity.setLocalRotation(0, 0, 0, 1); */ setLocalRotation(x: number, y: number, z: number, w: number): void; + setLocalRotation(...args: number[]): void; /** * @function @@ -449,6 +454,7 @@ declare namespace pc { * this.entity.setLocalScale(10, 10, 10); */ setLocalScale(x: number, y: number, z: number): void; + setLocalScale(...args: number[]): void; /** * @function @@ -484,6 +490,7 @@ declare namespace pc { * this.entity.setPosition(0, 10, 0); */ setPosition(x: number, y: number, z: number): void; + setPosition(...args: number[]): void; /** * @function @@ -521,6 +528,7 @@ declare namespace pc { * this.entity.setRotation(0, 0, 0, 1); */ setRotation(x: number, y: number, z: number, w: number): void; + setRotation(...args: number[]): void; /** * @function @@ -534,6 +542,7 @@ declare namespace pc { * this.entity.setEulerAngles(0, 90, 0); */ setEulerAngles(x: number, y: number, z: number): void; + setEulerAngles(...args: number[]): void; /** * @function diff --git a/types/playcanvas/engine/scene/material.d.ts b/types/playcanvas/engine/scene/material.d.ts index 1cb8d487f7..7d387cc0a0 100644 --- a/types/playcanvas/engine/scene/material.d.ts +++ b/types/playcanvas/engine/scene/material.d.ts @@ -57,6 +57,9 @@ declare namespace pc { alphaTest: number; alphaToCoverage: boolean; alphaWrite: boolean; + blend: boolean; + blendSrc: number; + blendDst: number; blendType: number; blueWrite: boolean; cull: number; diff --git a/types/playcanvas/engine/scene/mesh.d.ts b/types/playcanvas/engine/scene/mesh.d.ts index 6a0dca71e6..b9ecd12591 100644 --- a/types/playcanvas/engine/scene/mesh.d.ts +++ b/types/playcanvas/engine/scene/mesh.d.ts @@ -1,5 +1,12 @@ declare namespace pc { + type MeshPrimitive = { + type: number; + base: number; + count: number; + indexed?: boolean; + } + /** * @name pc.Mesh * @class A graphical primitive. The mesh is defined by a {@link pc.VertexBuffer} and an optional @@ -19,8 +26,10 @@ declare namespace pc { class Mesh { vertexBuffer: pc.VertexBuffer; indexBuffer: pc.IndexBuffer; - primitive: {}[]; + primitive: MeshPrimitive[]; aabb: pc.BoundingBox; + skin: pc.Skin; + morph: pc.Morph; } /** @@ -65,11 +74,8 @@ declare namespace pc { class MeshInstance { constructor(node: pc.GraphNode, mesh: pc.Mesh, material: pc.Material) - aabb: pc.BoundingBox; castShadow: boolean; visible: boolean; - layer: number; - material: pc.Material; renderStyle: number; cull: boolean; @@ -80,7 +86,21 @@ declare namespace pc { * To ignore all dynamic lights, set mask to 0. Defaults to 1. */ mask: number; + node: pc.GraphNode; + mesh: pc.Mesh; + aabb: pc.BoundingBox; + material: pc.Material; + layer: number; + receiveShadow: boolean; + skinInstance: pc.SkinInstance; + screenSpace: boolean; + key: number; + } + class Command { + constructor(layer: number, blendType: number, command: Function); + key: number; + conmand: Function; } } \ No newline at end of file diff --git a/types/playcanvas/engine/scene/model.d.ts b/types/playcanvas/engine/scene/model.d.ts index 0961d443af..f11ebf80fa 100644 --- a/types/playcanvas/engine/scene/model.d.ts +++ b/types/playcanvas/engine/scene/model.d.ts @@ -38,6 +38,8 @@ declare namespace pc { */ destroy(): void; + getMaterials(): pc.StandardMaterial[]; + /** * @function * @name pc.Model#generateWireframe diff --git a/types/playcanvas/engine/scene/morph.d.ts b/types/playcanvas/engine/scene/morph.d.ts new file mode 100644 index 0000000000..58e971ebec --- /dev/null +++ b/types/playcanvas/engine/scene/morph.d.ts @@ -0,0 +1,131 @@ +declare namespace pc { + + interface MorphTargetOptions { + deltaPositions: number[]; + deltaNormals?: number[]; + deltaTangents?: number[]; + indices?: number[]; + name?: string; + aabb?: pc.BoundingBox; + } + + /** + * @private + * @name pc.MorphTarget + * @class A Morph Target (also known as Blend Shape) contains deformation data to apply to existing mesh. + * Multiple morph targets can be blended together on a mesh. This is useful for effects that are hard to achieve with conventional animation and skinning. + * @param {Object} options Object for passing optional arguments. + * @param {Number[]} deltaPositions An array of 3-dimensional vertex position offsets. + * @param {Number[]} [deltaNormals] An array of 3-dimensional vertex normal offsets. + * @param {Number[]} [deltaTangents] An array of 4-dimensional vertex normal tangents. + * @param {Number[]} [options.indices] A morph target doesn't have to contain a full copy of the original mesh with added deformations. + * Instead, only deformed vertices can be stored. This array contains indices to the original mesh's vertices and must be of the same size + * as other arrays. + * @param {String} [name] Name + * @param {pc.BoundingBox} [aabb] Bounding box. Will be automatically generated, if undefined. + */ + class MorphTarget { + constructor(optionsi: MorphTargetOptions); + deltaPositions: number[]; + deltaNormals: number[]; + deltaTangents: number[]; + indices: number[]; + name: string; + aabb: pc.BoundingBox; + } + + /** + * @private + * @name pc.Morph + * @class Contains a list of pc.MorphTarget, a combined AABB and some associated data. + * @param {pc.MoprhTarget[]} targets A list of morph targets + */ + class Morph { + constructor(targets: pc.MorphTarget[]); + + aabb: pc.BoundingBox; + + /** + * @private + * @function + * @name pc.Morph#addTarget + * @description Adds a new morph target to the list + * @param {pc.MoprhTarget} target A new morph target + */ + addTarget(target: pc.MorphTarget): void; + + /** + * @private + * @function + * @name pc.Morph#removeTarget + * @description Remove the specified morph target from the list + * @param {pc.MoprhTarget} target A morph target to delete + */ + removeTarget(target: pc.MorphTarget): void; + + /** + * @private + * @function + * @name pc.Morph#getTarget + * @description Gets the morph target by index + * @param {Number} index An index of morph target. + * @returns {pc.MorphTarget} A morph target object + */ + getTarget(index: number): pc.MorphTarget; + } + + /** + * @private + * @name pc.MorphInstance + * @class An instance of pc.Morph. Contains weights to assign to every pc.MorphTarget, holds morphed buffer and associated data. + * @param {pc.Morph} morph The pc.Morph to instance. + */ + class MorphInstance { + constructor(morph: pc.Morph); + + morph: pc.Morph; + + /** + * @function + * @name pc.MorphInstance#destroy + * @description Frees video memory allocated by this object. + */ + destroy(): void; + + /** + * @private + * @function + * @name pc.MorphInstance#getWeight + * @description Gets current weight of the specified morph target. + * @param {Number} index An index of morph target. + * @returns {Number} Weight + */ + getWeight(index: number): number; + + /** + * @private + * @function + * @name pc.MorphInstance#setWeight + * @description Sets weight of the specified morph target. + * @param {Number} index An index of morph target. + * @param {Number} weight Weight + */ + setWeight(index: number, weight: number): void; + + /** + * @private + * @function + * @name pc.MorphInstance#updateBounds + * @description Calculates AABB for this morph instance. Called automatically by renderer. + */ + updateBounds(): void; + + /** + * @private + * @function + * @name pc.MorphInstance#update + * @description Performs morphing. Called automatically by renderer. + */ + update(mesh: pc.Mesh): void; + } +} \ No newline at end of file diff --git a/types/playcanvas/engine/scene/procedural.d.ts b/types/playcanvas/engine/scene/procedural.d.ts index 9b1f3e66d6..8254952918 100644 --- a/types/playcanvas/engine/scene/procedural.d.ts +++ b/types/playcanvas/engine/scene/procedural.d.ts @@ -59,7 +59,7 @@ declare namespace pc { * }); * @author Will Eastcott */ - function createMesh(device: pc.GraphicsDevice, positions: number[], opts: { + function createMesh(device: pc.GraphicsDevice, positions: number[], opts?: { normals: number[], tangents: number[], colors: number[], @@ -86,7 +86,7 @@ declare namespace pc { * @returns {pc.Mesh} A new torus-shaped mesh. * @author Will Eastcott */ - function createTorus(device: pc.GraphicsDevice, opts: { + function createTorus(device: pc.GraphicsDevice, opts?: { tubeRadius: number, ringRadius: number, segments: number, @@ -111,7 +111,7 @@ declare namespace pc { * @returns {pc.Mesh} A new cylinder-shaped mesh. * @author Will Eastcott */ - function createCylinder(device: pc.GraphicsDevice, opts: { + function createCylinder(device: pc.GraphicsDevice, opts?: { radius: number, height: number, heightSegments: number, @@ -136,7 +136,7 @@ declare namespace pc { * @returns {pc.Mesh} A new cylinder-shaped mesh. * @author Will Eastcott */ - function createCapsule(device: pc.GraphicsDevice, opts: { + function createCapsule(device: pc.GraphicsDevice, opts?: { radius: number, height: number, heightSegments: number, @@ -162,7 +162,7 @@ declare namespace pc { * @returns {pc.Mesh} A new cone-shaped mesh. * @author Will Eastcott */ - function createCone(device: pc.GraphicsDevice, opts: { + function createCone(device: pc.GraphicsDevice, opts?: { baseRadius: number, peakRadius: number, height: number, @@ -186,7 +186,7 @@ declare namespace pc { * @returns {pc.Mesh} A new sphere-shaped mesh. * @author Will Eastcott */ - function createSphere(device: pc.GraphicsDevice, opts: { + function createSphere(device: pc.GraphicsDevice, opts?: { radius: number, segments: number }): pc.Mesh; @@ -209,7 +209,7 @@ declare namespace pc { * @returns {pc.Mesh} A new plane-shaped mesh. * @author Will Eastcott */ - function createPlane(device: pc.GraphicsDevice, opts: { + function createPlane(device: pc.GraphicsDevice, opts?: { halfExtents: pc.Vec2, widthSegments: number, lenghtSegments: number @@ -233,7 +233,7 @@ declare namespace pc { * @return {pc.Mesh} A new box-shaped mesh. * @author Will Eastcott */ - function createBox(device: pc.GraphicsDevice, opts: { + function createBox(device: pc.GraphicsDevice, opts?: { halfExtents: pc.Vec3, widthSegments: number, lengthSegments: number, diff --git a/types/playcanvas/engine/scene/scene.d.ts b/types/playcanvas/engine/scene/scene.d.ts index 87bf620a9e..c73e3c61ee 100644 --- a/types/playcanvas/engine/scene/scene.d.ts +++ b/types/playcanvas/engine/scene/scene.d.ts @@ -326,5 +326,7 @@ declare namespace pc { * @author Will Eastcott */ update(): void; + + setSkybox(cubemaps: pc.Texture[]): void; } -} \ No newline at end of file +} diff --git a/types/playcanvas/engine/script/script.d.ts b/types/playcanvas/engine/script/script.d.ts index 21cd5540d9..f1565d1c47 100644 --- a/types/playcanvas/engine/script/script.d.ts +++ b/types/playcanvas/engine/script/script.d.ts @@ -144,6 +144,9 @@ declare namespace pc { * }; */ function createScript>(name: string, app?: pc.Application): Class; + namespace createScript { + export let reservedAttributes: any; + } /** * @name ScriptType @@ -172,7 +175,7 @@ declare namespace pc { * @type String * @description Name of a Script Type. */ - _name: string; + __name: string; /** * @field @@ -220,9 +223,6 @@ declare namespace pc { interface ScriptType { [key: string]: any; - app: pc.Application; - entity: pc.Entity; - enabled: boolean; /** * initialize is called if defined when script is about to run for the first time. @@ -231,7 +231,7 @@ declare namespace pc { initialize?(): void; /** - * postInitialize will run after all initialize methods are executed in the + * postInitialize will run after all initialize methods are executed in the * same tick or enabling chain of actions. * @memberof ScriptType */ @@ -239,22 +239,22 @@ declare namespace pc { /** * update is called if defined for enabled (running state) scripts on each tick. - * @param {number} dt + * @param {number} dt * @memberof ScriptType */ update?(dt: number): void; /** - * postUpdate is called if defined for enabled (running state) scripts on each tick, + * postUpdate is called if defined for enabled (running state) scripts on each tick, * after update. * @memberof ScriptType */ postUpdate?(): void; /** - * This method will be called when a ScriptType that already exists in the registry - * gets redefined. If the new ScriptType has a `swap` method in its prototype, - * then it will be executed to perform hot-reload at runtime. + * This method will be called when a ScriptType that already exists in the registry + * gets redefined. If the new ScriptType has a `swap` method in its prototype, + * then it will be executed to perform hot-reload at runtime. * @memberof ScriptType */ swap?(): void; @@ -274,7 +274,7 @@ declare namespace pc { * }); * obj.fire('test', 1, 2); // prints 3 to the console */ - on(name: string, callback: (...args: any[]) => void, scope: any): any; + on?(name: string, callback: (...args: any[]) => void, scope: any): any; /** * @function @@ -294,7 +294,7 @@ declare namespace pc { * obj.off('test', handler); // Removes all handler functions, called 'test' * obj.off('test', handler, this); // Removes all hander functions, called 'test' with scope this */ - off(name: string, callback: (...args: any[]) => void, scope: any): any; + off?(name: string, callback: (...args: any[]) => void, scope: any): any; /** * @function @@ -305,7 +305,7 @@ declare namespace pc { * @example * obj.fire('test', 'This is the message'); */ - fire(name: string, arg1: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any, arg6?: any, arg7?: any, arg8?: any): any; + fire?(name: string, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any, arg6?: any, arg7?: any, arg8?: any): any; /** * @function @@ -321,7 +321,7 @@ declare namespace pc { * obj.fire('test', 1, 2); // prints 3 to the console * obj.fire('test', 1, 2); // not going to get handled */ - once(name: string, callback: (...args: any[]) => void, scope: any): any; + once?(name: string, callback: (...args: any[]) => void, scope: any): any; /** * @function @@ -332,7 +332,7 @@ declare namespace pc { * obj.on('test', function () { }); // bind an event to 'test' * obj.hasEvent('test'); // returns true */ - hasEvent(name: string): boolean; + hasEvent?(name: string): boolean; } -} \ No newline at end of file +} diff --git a/types/playcanvas/engine/scriptype.d.ts b/types/playcanvas/engine/scriptype.d.ts index 89fb94c5c4..bd9dc5dfc0 100644 --- a/types/playcanvas/engine/scriptype.d.ts +++ b/types/playcanvas/engine/scriptype.d.ts @@ -1,5 +1,5 @@ interface ScriptType { - name: string; + name?: string; /** * Interface to define public script attributes available in the editor. @@ -13,7 +13,7 @@ interface ScriptType { * @memberof ScriptType */ initialize?(): void; - + /** * postInitialize will run after all initialize methods are executed in the * same tick or enabling chain of actions. @@ -42,4 +42,4 @@ interface ScriptType { * @memberof ScriptType */ swap?(): void; -} \ No newline at end of file +} diff --git a/types/playcanvas/engine/shape/bounding-box.d.ts b/types/playcanvas/engine/shape/bounding-box.d.ts index 67340a2246..b91183b607 100644 --- a/types/playcanvas/engine/shape/bounding-box.d.ts +++ b/types/playcanvas/engine/shape/bounding-box.d.ts @@ -21,6 +21,10 @@ declare namespace pc { */ add(other: pc.BoundingBox): void; + copy(src: pc.BoundingBox): void; + + clone(): pc.BoundingBox; + /** * @function * @name pc.BoundingBox#intersects @@ -38,7 +42,7 @@ declare namespace pc { * @param {pc.Vec3} [point] If there is an intersection, the intersection point will be copied into here. * @returns {Boolean} True if there is an intersection. */ - intersectsRay(ray: pc.Ray, point: pc.Vec3): boolean; + intersectsRay(ray: pc.Ray, point?: pc.Vec3): boolean; /** * @function diff --git a/types/playcanvas/engine/shape/bounding-sphere.d.ts b/types/playcanvas/engine/shape/bounding-sphere.d.ts index 5fd1c3503f..f25c92072b 100644 --- a/types/playcanvas/engine/shape/bounding-sphere.d.ts +++ b/types/playcanvas/engine/shape/bounding-sphere.d.ts @@ -24,7 +24,7 @@ declare namespace pc { * @param {pc.Vec3} [point] If there is an intersection, the intersection point will be copied into here. * @returns {Boolean} True if there is an intersection. */ - intersectsRay(ray: pc.Ray, point: pc.Vec3): boolean; + intersectsRay(ray: pc.Ray, point?: pc.Vec3): boolean; /** * @function diff --git a/types/playcanvas/engine/shape/oriented-box.d.ts b/types/playcanvas/engine/shape/oriented-box.d.ts index 47ca9df330..aeff67f2e8 100644 --- a/types/playcanvas/engine/shape/oriented-box.d.ts +++ b/types/playcanvas/engine/shape/oriented-box.d.ts @@ -21,7 +21,7 @@ declare namespace pc { * @param {pc.Vec3} [point] If there is an intersection, the intersection point will be copied into here. * @returns {Boolean} True if there is an intersection. */ - intersectsRay(ray: pc.Ray, point: pc.Vec3): boolean; + intersectsRay(ray: pc.Ray, point?: pc.Vec3): boolean; /** * @function diff --git a/types/playcanvas/engine/shape/plane.d.ts b/types/playcanvas/engine/shape/plane.d.ts index a7ce142fd6..fcb8a557dc 100644 --- a/types/playcanvas/engine/shape/plane.d.ts +++ b/types/playcanvas/engine/shape/plane.d.ts @@ -9,7 +9,10 @@ declare namespace pc { * @param {pc.Vec3} [normal] Normal of the plane. The constructor takes a reference of this parameter. */ class Plane { - constructor(point: pc.Vec3, normal: pc.Vec3) + constructor(point?: pc.Vec3, normal?: pc.Vec3) + + point: pc.Vec3; + normal: pc.Vec3; /** * @function @@ -30,6 +33,6 @@ declare namespace pc { * @param {pc.Vec3} [point] If there is an intersection, the intersection point will be copied into here * @returns {Boolean} True if there is an intersection */ - intersectsRay(ray: pc.Ray, point: pc.Vec3): boolean; + intersectsRay(ray: pc.Ray, point?: pc.Vec3): boolean; } } diff --git a/types/playcanvas/engine/vr/vr-display.d.ts b/types/playcanvas/engine/vr/vr-display.d.ts index a39562c143..c0d23fc944 100644 --- a/types/playcanvas/engine/vr/vr-display.d.ts +++ b/types/playcanvas/engine/vr/vr-display.d.ts @@ -1,5 +1,5 @@ -type NativeVRDisplay = typeof VRDisplay; -type NativeVRDisplayCapabilities = typeof VRDisplayCapabilities; +type NativeVRDisplay = VRDisplay; +type NativeVRDisplayCapabilities = VRDisplayCapabilities; declare namespace pc { @@ -96,6 +96,6 @@ declare namespace pc { * @description Return the current frame data that is updated during polling. * @returns {VRFrameData} The frame data object */ - getFrameData(): void; + getFrameData(): void; } } diff --git a/types/playcanvas/index.d.ts b/types/playcanvas/index.d.ts index 03899cd1b9..24fe7ec6ee 100644 --- a/types/playcanvas/index.d.ts +++ b/types/playcanvas/index.d.ts @@ -3,6 +3,7 @@ // Definitions by: Philippe Vaillancourt // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// /// /// /// @@ -52,10 +53,14 @@ /// /// /// +/// /// +/// /// -/// +/// /// +/// +/// /// /// /// @@ -72,6 +77,7 @@ /// /// /// +/// /// /// /// diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 108a12bf0e..081a62cbd7 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -576,10 +576,9 @@ declare namespace R { * Takes a function and two values in its domain and returns true if the values map to the same value in the * codomain; false otherwise. */ - eqBy(fn: (a: T) => T, a: T, b: T): boolean; - eqBy(fn: (a: T) => T, a: T): (b: T) => boolean; - eqBy(fn: (a: T) => T): (a: T, b: T) => boolean; - eqBy(fn: (a: T) => T): (a: T) => (b: T) => boolean; + 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; /** * Reports whether two functions have the same value for the specified property. @@ -1601,6 +1600,10 @@ declare namespace R { * Returns a new list with the same elements as the original list, just in the reverse order. */ reverse(list: ReadonlyArray): T[]; + /** + * Returns a new string with the characters in reverse order. + */ + reverse(str: string): string; /** * Scan is similar to reduce, but returns a list of successively reduced values from the left. diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index eacb4558e3..c32ab72028 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -977,6 +977,13 @@ type Pair = KeyValuePair; R.reverse([]); // => [] }; +() => { + R.reverse('abc'); // => 'cba' + R.reverse('ab'); // => 'ba' + R.reverse('a'); // => 'a' + R.reverse(''); // => '' +}; + () => { const numbers = [1, 2, 3, 4]; R.scan(R.multiply, 1, numbers); // => [1, 1, 2, 6, 24] @@ -2129,6 +2136,14 @@ class Rectangle { const c: (a: any[]) => any[] = R.symmetricDifferenceWith(eqA)(l1); // => [{a: 1}, {a: 2}, {a: 5}, {a: 6}] }; +() => { + const eqL = R.eqBy(s => s.length); + const l1 = ['bb', 'ccc', 'dddd']; + const l2 = ['aaa', 'bb', 'c']; + R.symmetricDifferenceWith(eqL, l1, l2); // => ['dddd', 'c'] + R.symmetricDifferenceWith(eqL)(l1, l2); // => ['dddd', 'c'] +}; + /***************************************************************** * String category */ diff --git a/types/react-helmet-async/index.d.ts b/types/react-helmet-async/index.d.ts new file mode 100644 index 0000000000..1a240b075b --- /dev/null +++ b/types/react-helmet-async/index.d.ts @@ -0,0 +1,20 @@ +// Type definitions for react-helmet-async 0.0 +// Project: https://github.com/staylor/react-helmet-async#readme +// Definitions by: forabi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import * as React from 'react'; + +import Helmet, { HelmetData } from 'react-helmet'; +export default Helmet; + +export interface PopulatedContext { + helmet: HelmetData; +} + +interface ProviderProps { + context?: {}; +} + +export class HelmetProvider extends React.Component {} diff --git a/types/react-helmet-async/react-helmet-async-tests.tsx b/types/react-helmet-async/react-helmet-async-tests.tsx new file mode 100644 index 0000000000..e91f437edc --- /dev/null +++ b/types/react-helmet-async/react-helmet-async-tests.tsx @@ -0,0 +1,15 @@ +import * as React from 'react'; +import { renderToString } from 'react-dom/server'; +import Helmet, { HelmetProvider, PopulatedContext } from 'react-helmet-async'; + +const helmetContext = {}; + +const markup = renderToString( + +
+ + Hello, world! + +
+
+); diff --git a/types/react-helmet-async/tsconfig.json b/types/react-helmet-async/tsconfig.json new file mode 100644 index 0000000000..bbd3f732ac --- /dev/null +++ b/types/react-helmet-async/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "jsx": "react", + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "react-helmet-async-tests.tsx"] +} diff --git a/types/react-helmet-async/tslint.json b/types/react-helmet-async/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-helmet-async/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/react-native-loading-spinner-overlay/index.d.ts b/types/react-native-loading-spinner-overlay/index.d.ts new file mode 100644 index 0000000000..93d511d863 --- /dev/null +++ b/types/react-native-loading-spinner-overlay/index.d.ts @@ -0,0 +1,21 @@ +// Type definitions for react-native-loading-spinner-overlay 0.5 +// Project: https://github.com/joinspontaneous/react-native-loading-spinner-overlay +// Definitions by: fhelwanger +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import * as React from "react"; +import * as ReactNative from "react-native"; + +export interface SpinnerProps { + cancelable?: boolean; + color?: string; + animation?: "none" | "slide" | "fade"; + overlayColor?: string; + size?: "normal" | "small" | "large"; + textContent?: string; + textStyle?: ReactNative.StyleProp; + visible?: boolean; +} + +export default class Spinner extends React.Component {} diff --git a/types/react-native-loading-spinner-overlay/react-native-loading-spinner-overlay-tests.tsx b/types/react-native-loading-spinner-overlay/react-native-loading-spinner-overlay-tests.tsx new file mode 100644 index 0000000000..2b507ccb12 --- /dev/null +++ b/types/react-native-loading-spinner-overlay/react-native-loading-spinner-overlay-tests.tsx @@ -0,0 +1,19 @@ +import * as React from "react"; +import Spinner from "react-native-loading-spinner-overlay"; + +() => { + ; +}; + +() => { + ; +}; diff --git a/types/react-native-loading-spinner-overlay/tsconfig.json b/types/react-native-loading-spinner-overlay/tsconfig.json new file mode 100644 index 0000000000..ef459656dc --- /dev/null +++ b/types/react-native-loading-spinner-overlay/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-native-loading-spinner-overlay-tests.tsx" + ] +} diff --git a/types/react-native-loading-spinner-overlay/tslint.json b/types/react-native-loading-spinner-overlay/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-native-loading-spinner-overlay/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 2c3c384ac6..c4e396783f 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -1,5 +1,5 @@ -// Type definitions for react-navigation 1.0 -// Project: https://github.com/react-community/react-navigation +// Type definitions for react-navigation 1.2 +// Project: https://github.com/react-navigation/react-navigation // Definitions by: Huhuanming // mhcgrq // fangpenlin @@ -11,16 +11,18 @@ // Tim Wang // Qibang Sun // Sergei Butko: +// Veit Lehmann: +// Roberto Huertas: +// Steven Miller // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 /** - * BEGIN FLOW TYPEDEFINITION.JS PORT - * Reference: https://github.com/react-community/react-navigation/tree/52a2846e77119148320bcea83b8982a8bc6acce3 + * Reference: https://github.com/react-navigation/react-navigation/tree/a37473c5e4833f48796ee6c7c9cb4a8ac49d9c06 * * NOTE: Please update the commit/link above when updating to a new Flow - * TypeDefinition.js reference, so we can conveniently just look at diffs on - * TypeDefinition.js between this latest reference point and the one you are + * react-navigation/flow/react-navigation.js reference, so we can conveniently just look at diffs on + * react-navigation/flow/react-navigation.js between this latest reference point and the one you are * using when making new updates. */ @@ -72,9 +74,9 @@ export interface NavigationState { routes: any[]; } -export type NavigationRoute = NavigationLeafRoute | NavigationStateRoute; +export type NavigationRoute = NavigationLeafRoute | NavigationStateRoute; -export interface NavigationLeafRoute { +export interface NavigationLeafRoute { /** * React's key used by some navigators. No need to specify these manually, * they will be defined by the router. @@ -93,16 +95,13 @@ export interface NavigationLeafRoute { * Params passed to this route when navigating to it, * e.g. `{ car_id: 123 }` in a route that displays a car. */ - params: Params; + params?: NavigationParams; } -export interface NavigationStateRoute extends NavigationLeafRoute { - index: number; - routes: Array>; -} +export type NavigationStateRoute = NavigationLeafRoute & NavigationState; -export type NavigationScreenOptionsGetter = ( - navigation: NavigationScreenProp, Action>, +export type NavigationScreenOptionsGetter = ( + navigation: NavigationScreenProp, screenProps?: { [key: string]: any } ) => Options; @@ -112,7 +111,7 @@ export interface NavigationRouter { * an optional previous state. When the action is considered handled but the * state is unchanged, the output state is null. */ - getStateForAction: (action: Action, lastState: (State | null)) => (State | null); + getStateForAction: (action: Action, lastState?: State) => (State | null); /** * Maps a URI-like string to an action. This can be mapped to a state @@ -142,20 +141,20 @@ export interface NavigationRouter { * * {routeName: 'Foo', key: '123'} */ - getScreenOptions: NavigationScreenOptionsGetter; + getScreenOptions: NavigationScreenOptionsGetter; } export type NavigationScreenOption = T | (( - navigation: NavigationScreenProp, NavigationAction>, + navigation: NavigationScreenProp, config: T ) => T); export interface NavigationScreenDetails { options: T; - state: NavigationRoute; - navigation: NavigationScreenProp, NavigationAction>; + state: NavigationRoute; + navigation: NavigationScreenProp; } export interface NavigationScreenOptions { @@ -163,19 +162,15 @@ export interface NavigationScreenOptions { } export interface NavigationScreenConfigProps { - navigation: NavigationScreenProp, NavigationAction>; + navigation: NavigationScreenProp; screenProps: { [key: string]: any }; } export type NavigationScreenConfig = Options - | (NavigationScreenConfigProps & - ((navigationOptionsContainer: { - navigationOptions: NavigationScreenProp< - NavigationRoute, - NavigationAction - >, - }) => Options)); + | ((navigationOptionsContainer: NavigationScreenConfigProps & { + navigationOptions: NavigationScreenProp, + }) => Options); export type NavigationComponent = NavigationScreenComponent @@ -263,6 +258,7 @@ export interface NavigationStackViewConfig { export type NavigationStackScreenOptions = NavigationScreenOptions & { header?: (React.ReactElement | ((headerProps: HeaderProps) => React.ReactElement)) | null; + headerTransparent?: boolean; headerTitle?: string | React.ReactElement; headerTitleStyle?: StyleProp; headerTintColor?: string; @@ -273,11 +269,13 @@ export type NavigationStackScreenOptions = NavigationScreenOptions & { headerPressColorAndroid?: string; headerRight?: React.ReactElement; headerStyle?: StyleProp; + headerBackground?: React.ReactNode | React.ReactType; gesturesEnabled?: boolean; gestureResponseDistance?: { vertical?: number; horizontal?: number }; }; export interface NavigationStackRouterConfig { + headerTransitionPreset?: 'fade-in-place' | 'uikit'; initialRouteName?: string; initialRouteParams?: NavigationParams; paths?: NavigationPathsConfig; @@ -301,18 +299,16 @@ export type NavigationAction = | NavigationStackAction | NavigationTabAction; -export type NavigationRouteConfig = T & { +export type NavigationRouteConfig = NavigationComponent | ({ navigationOptions?: NavigationScreenConfig, path?: string, -}; +} & NavigationScreenRouteConfig); -export type NavigationScreenRouteConfig = - { - screen: NavigationComponent, - } - | { - getScreen: () => NavigationComponent, - }; +export type NavigationScreenRouteConfig = NavigationComponent | { + screen: NavigationComponent, +} | { + getScreen: () => NavigationComponent, +}; export interface NavigationPathsConfig { [routeName: string]: string; @@ -328,7 +324,7 @@ export interface NavigationTabRouterConfig { backBehavior?: 'none' | 'initialRoute'; // defaults `initialRoute` } export interface TabScene { - route: NavigationRoute; + route: NavigationRoute; focused: boolean; index: number; tintColor?: string; @@ -368,19 +364,41 @@ export interface NavigationDrawerScreenOptions extends NavigationScreenOptions { } export interface NavigationRouteConfigMap { - [routeName: string]: NavigationRouteConfig; + [routeName: string]: NavigationRouteConfig; } -export type NavigationDispatch = (action: A) => boolean; +export type NavigationDispatch = (action: NavigationAction) => boolean; -export interface NavigationProp { +export interface NavigationProp { state: S; - dispatch: NavigationDispatch; + dispatch: NavigationDispatch; } -export interface NavigationScreenProp { +export type EventType = +| 'willFocus' +| 'didFocus' +| 'willBlur' +| 'didBlur' +| 'action'; + +export interface NavigationEventPayload { + type: EventType; + action: NavigationAction; + state: NavigationState; + lastState: NavigationState; +} + +export type NavigationEventCallback = ( + payload: NavigationEventPayload +) => void; + +export interface NavigationEventSubscription { + remove: () => void; +} + +export interface NavigationScreenProp { state: S; - dispatch: NavigationDispatch; + dispatch: NavigationDispatch; goBack: (routeKey?: (string | null)) => boolean; navigate: ( routeName: string, @@ -388,10 +406,26 @@ export interface NavigationScreenProp { action?: NavigationAction ) => boolean; setParams: (newParams: NavigationParams) => boolean; + addListener: ( + eventName: string, + callback: NavigationEventCallback + ) => NavigationEventSubscription; + push: ( + routeName: string, + params?: NavigationParams, + action?: NavigationNavigateAction + ) => boolean; + replace: ( + routeName: string, + params?: NavigationParams, + action?: NavigationNavigateAction + ) => boolean; + pop: (n?: number, params?: { immediate?: boolean }) => boolean; + popToTop: (params?: { immediate?: boolean }) => boolean; } -export interface NavigationNavigatorProps { - navigation?: NavigationProp; +export interface NavigationNavigatorProps { + navigation?: NavigationProp; screenProps?: { [key: string]: any }; navigationOptions?: any; } @@ -415,7 +449,7 @@ export interface NavigationScene { isActive: boolean; isStale: boolean; key: string; - route: NavigationRoute; + route: NavigationRoute; } export interface NavigationTransitionProps { @@ -423,7 +457,7 @@ export interface NavigationTransitionProps { layout: NavigationLayout; // The destination navigation state of the transition - navigation: NavigationScreenProp; + navigation: NavigationScreenProp; // The progressive index of the transitioner's navigation state. position: AnimatedValue; @@ -496,24 +530,22 @@ export interface LayoutEvent { }; } -/** - * END FLOW TYPEDEFINITION.JS PORT - */ - -/** - * BEGIN MANUAL DEFINITIONS OUTSIDE OF TYPEDEFINITION.JS - */ - -// From navigators/NavigatorTypes.js export type NavigatorType = | 'react-navigation/STACK' | 'react-navigation/TABS' | 'react-navigation/DRAWER'; -// From addNavigatorHelpers.js -export function addNavigationHelpers(navigation: NavigationProp): NavigationScreenProp; +export function addNavigationHelpers( + navigation: { + state: S; + dispatch: (action: NavigationAction) => any; + addListener?: ( + eventName: string, + callback: NavigationEventCallback + ) => NavigationEventSubscription; + } +): NavigationScreenProp; -// From createNavigationContainer.js export interface NavigationContainerProps { uriPrefix?: string | RegExp; onNavigationStateChange?: ( @@ -544,7 +576,7 @@ export function StackNavigator( ): NavigationContainer; // DrawerItems -export const DrawerItems: React.ComponentType; +export const DrawerItems: React.ReactType; /** * Drawer Navigator @@ -553,7 +585,7 @@ export interface DrawerViewConfig { drawerBackgroundColor?: string; drawerWidth?: number; drawerPosition?: 'left' | 'right'; - contentComponent?: React.ComponentType; + contentComponent?: React.ReactType; contentOptions?: any; style?: StyleProp; } @@ -580,7 +612,7 @@ export function DrawerNavigator( // From views/TabView/TabView.js export interface TabViewConfig { - tabBarComponent?: React.ComponentType; + tabBarComponent?: React.ReactType; tabBarPosition?: 'top' | 'bottom'; tabBarOptions?: { activeTintColor?: string, @@ -608,6 +640,8 @@ export interface TabViewConfig { // From navigators/TabNavigator.js export interface TabNavigatorConfig extends NavigationTabRouterConfig, TabViewConfig { + lazy?: boolean; + removeClippedSubviews?: boolean; initialLayout?: { height: number, width: number }; } @@ -617,8 +651,62 @@ export function TabNavigator( drawConfig?: TabNavigatorConfig, ): NavigationContainer; -export const TabBarTop: React.ComponentType; -export const TabBarBottom: React.ComponentType; +export interface TabBarTopProps { + activeTintColor: string; + inactiveTintColor: string; + showIcon: boolean; + showLabel: boolean; + upperCaseLabel: boolean; + allowFontScaling: boolean; + position: AnimatedValue; + tabBarPosition: string; + navigation: NavigationScreenProp; + jumpToIndex: (index: number) => void; + getLabel: (scene: TabScene) => (React.ReactNode | string); + getOnPress: ( + previousScene: NavigationRoute, + scene: TabScene + ) => (args: { + previousScene: NavigationRoute, + scene: TabScene, + jumpToIndex: (index: number) => void, + }) => void; + renderIcon: (scene: TabScene) => React.ReactElement; + labelStyle?: TextStyle; + iconStyle?: ViewStyle; +} + +export interface TabBarBottomProps { + activeTintColor: string; + activeBackgroundColor: string; + adaptive?: boolean; + inactiveTintColor: string; + inactiveBackgroundColor: string; + showLabel?: boolean; + allowFontScaling: boolean; + position: AnimatedValue; + navigation: NavigationScreenProp; + jumpToIndex: (index: number) => void; + getLabel: (scene: TabScene) => (React.ReactNode | string); + getOnPress: ( + previousScene: NavigationRoute, + scene: TabScene + ) => (args: { + previousScene: NavigationRoute, + scene: TabScene, + jumpToIndex: (index: number) => void, + }) => void; + getTestIDProps: (scene: TabScene) => (scene: TabScene) => any; + renderIcon: (scene: TabScene) => React.ReactNode; + style?: ViewStyle; + animateStyle?: ViewStyle; + labelStyle?: TextStyle; + tabStyle?: ViewStyle; + showIcon?: boolean; +} + +export const TabBarTop: React.ComponentType; +export const TabBarBottom: React.ComponentType; /** * NavigationActions @@ -647,7 +735,7 @@ export interface TransitionerProps { transitionProps: NavigationTransitionProps, prevTransitionProps?: NavigationTransitionProps ) => NavigationTransitionSpec; - navigation: NavigationScreenProp; + navigation: NavigationScreenProp; onTransitionEnd?: () => void; onTransitionStart?: () => void; render: ( @@ -692,7 +780,7 @@ export function StackRouter( /** * Create Navigator * - * @see https://github.com/react-community/react-navigation/blob/master/src/navigators/createNavigator.js + * @see https://github.com/react-navigation/react-navigation/blob/master/src/navigators/createNavigator.js */ export function createNavigator( router: NavigationRouter, @@ -707,7 +795,7 @@ export function createNavigator( * This allows to use e.g. the StackNavigator and TabNavigator as root-level * components. * - * @see https://github.com/react-community/react-navigation/blob/master/src/createNavigationContainer.js + * @see https://github.com/react-navigation/react-navigation/blob/master/src/createNavigationContainer.js */ export function createNavigationContainer( Component: NavigationNavigator @@ -720,8 +808,8 @@ export function createNavigationContainer( * BEGIN CUSTOM CONVENIENCE INTERFACES */ -export interface NavigationScreenProps { - navigation: NavigationScreenProp, NavigationAction>; +export interface NavigationScreenProps { + navigation: NavigationScreenProp; screenProps?: { [key: string]: any }; navigationOptions?: NavigationScreenConfig; } @@ -751,3 +839,15 @@ export const HeaderBackButton: React.ComponentClass; * Header Component */ export const Header: React.ComponentClass; + +export interface NavigationInjectedProps { + navigation: NavigationScreenProp; +} + +export function withNavigation( + Component: React.ComponentType +): React.ComponentType; + +export function withNavigationFocus( + Component: React.ComponentType +): React.ComponentType; diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index 662cd0bb9d..017a9b9153 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -31,6 +31,7 @@ import { addNavigationHelpers, HeaderBackButton, Header, + NavigationParams, } from 'react-navigation'; // Constants @@ -42,21 +43,17 @@ const viewStyle: ViewStyle = { }; const ROUTE_NAME_START_SCREEN = "StartScreen"; -interface StartScreenNavigationParams { - id: number; - s: string; -} /** * @desc Simple screen component class with typed component props that should * receive the navigation prop from the AppNavigator. */ -class StartScreen extends React.Component> { +class StartScreen extends React.Component { render() { // Implicit type checks. - const navigationStateParams: StartScreenNavigationParams = this.props.navigation.state.params; - const id = this.props.navigation.state.params.id; - const s = this.props.navigation.state.params.s; + const navigationStateParams = this.props.navigation.state.params; + const id = this.props.navigation.state.params && this.props.navigation.state.params.id; + const s = this.props.navigation.state.params && this.props.navigation.state.params.s; return ( @@ -65,25 +62,22 @@ class StartScreen extends React.Component { - const params: NextScreenNavigationParams = { - id: this.props.navigation.state.params.id, - name: this.props.navigation.state.params.s, + const params = { + id: this.props.navigation.state.params && this.props.navigation.state.params.id, + name: this.props.navigation.state.params && this.props.navigation.state.params.s, }; this.props.navigation.navigate(ROUTE_NAME_NEXT_SCREEN, params); } } const ROUTE_NAME_NEXT_SCREEN = "NextScreen"; -interface NextScreenNavigationParams { - id: number; - name: string; -} -class NextScreen extends React.Component> { + +class NextScreen extends React.Component { render() { // Implicit type checks. - const navigationStateParams: NextScreenNavigationParams = this.props.navigation.state.params; - const id = this.props.navigation.state.params.id; - const name = this.props.navigation.state.params.name; + const navigationStateParams = this.props.navigation.state.params; + const id = this.props.navigation.state.params && this.props.navigation.state.params.id; + const name = this.props.navigation.state.params && this.props.navigation.state.params.name; return ( @@ -94,7 +88,7 @@ class NextScreen extends React.Component (stackNavigatorScreenOptions), +}; + +const AdvancedStackNavigator = StackNavigator( + routeConfigMap, + stackNavigatorConfigWithNavigationOptionsAsFunction +); + +function renderAdvancedStackNavigator(): JSX.Element { + return ( + { }} + style={viewStyle} + /> + ); +} + /** * Drawer navigator. */ @@ -236,7 +250,7 @@ function renderBasicDrawerNavigator(): JSX.Element { } interface CustomTransitionerProps { - navigation: NavigationScreenProp; + navigation: NavigationScreenProp; } /** * @desc Custom transitioner component. Follows react-navigation/src/views/CardStackTransitioner.js. diff --git a/types/react-redux-epic/client.d.ts b/types/react-redux-epic/client.d.ts new file mode 100644 index 0000000000..54535f59ec --- /dev/null +++ b/types/react-redux-epic/client.d.ts @@ -0,0 +1,7 @@ +import * as React from 'react'; +import { Observable } from 'rxjs/Observable'; + +export function render( + element: React.ReactElement, + container: Element +): Observable; diff --git a/types/react-redux-epic/index.d.ts b/types/react-redux-epic/index.d.ts new file mode 100644 index 0000000000..f9bba811f8 --- /dev/null +++ b/types/react-redux-epic/index.d.ts @@ -0,0 +1,22 @@ +// Type definitions for react-redux-epic 1.1 +// Project: https://github.com/BerkeleyTrue/react-redux-epic#readme +// Definitions by: forabi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import * as React from 'react'; +import { Observable } from 'rxjs/Observable'; +import { Epic } from 'redux-observable'; + +export interface Action { + type: string; +} + +export function wrapRootEpic( + epic: Epic +): Epic; + +export function renderToString( + element: React.ReactElement, + wrappedEpic: Epic +): Observable<{ markup: string }>; diff --git a/types/react-redux-epic/package.json b/types/react-redux-epic/package.json new file mode 100644 index 0000000000..807e511de4 --- /dev/null +++ b/types/react-redux-epic/package.json @@ -0,0 +1,7 @@ +{ + "private": true, + "dependencies": { + "rxjs": "^5.5.5", + "redux-observable": "^0.18.0" + } +} diff --git a/types/react-redux-epic/react-redux-epic-tests.tsx b/types/react-redux-epic/react-redux-epic-tests.tsx new file mode 100644 index 0000000000..fa1d4f9c77 --- /dev/null +++ b/types/react-redux-epic/react-redux-epic-tests.tsx @@ -0,0 +1,26 @@ +import * as React from 'react'; +import { Epic } from 'redux-observable'; +import { renderToString, wrapRootEpic } from 'react-redux-epic'; +import 'rxjs/add/operator/do'; +import 'rxjs/add/operator/ignoreElements'; + +interface Action { + type: string; + payload: any; +} + +const rootEpic: Epic = action$ => { + return action$ + .do(action => { + // Action dispatched + }) + .ignoreElements(); +}; + +const wrappedRootEpic = wrapRootEpic(rootEpic); + +renderToString(
Hello, world
, wrappedRootEpic).subscribe({ + next({ markup }) { + // Done + } +}); diff --git a/types/react-redux-epic/tsconfig.json b/types/react-redux-epic/tsconfig.json new file mode 100644 index 0000000000..64657de53c --- /dev/null +++ b/types/react-redux-epic/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "jsx": "React", + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "client.d.ts", "react-redux-epic-tests.tsx"] +} diff --git a/types/react-redux-epic/tslint.json b/types/react-redux-epic/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/react-redux-epic/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/react-stripe-elements/index.d.ts b/types/react-stripe-elements/index.d.ts index 8713d5828a..2776d0c490 100644 --- a/types/react-stripe-elements/index.d.ts +++ b/types/react-stripe-elements/index.d.ts @@ -45,8 +45,6 @@ export namespace ReactStripeElements { interface ElementProps extends ElementsOptions { className?: string; - paymentRequest?: object; - elementRef?(): void; onChange?(event: ElementChangeResponse): void; diff --git a/types/react-svg/index.d.ts b/types/react-svg/index.d.ts new file mode 100644 index 0000000000..31a4533f57 --- /dev/null +++ b/types/react-svg/index.d.ts @@ -0,0 +1,40 @@ +// Type definitions for react-svg 2.2 +// Project: https://github.com/atomic-app/react-svg +// Definitions by: Chen Junda +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import * as React from "react"; + +declare class ReactSVG extends React.Component {} + +export = ReactSVG; + +declare namespace ReactSVG { + interface ReactSVGProps { + /** + * Path to the SVG. + */ + path: string; + /** + * Function to call after the SVG is injected. Receives the newly injected SVG DOM element as a parameter. Defaults to null. + */ + callback?: (dom: SVGSVGElement) => void; + /** + * Class name to be added to the SVG. Defaults to ''. + */ + className?: string; + /** + * Class name to be added to the wrapping div. Defaults to ''. + */ + wrapperClassName?: string; + /** + * Run any script blocks found in the SVG (always, once, or never). Defaults to never. + */ + evalScripts?: 'always' | 'once' | 'never'; + /** + * Inline styles to be added to the SVG. Defaults to {}. + */ + style?: any; + } +} diff --git a/types/react-svg/react-svg-tests.tsx b/types/react-svg/react-svg-tests.tsx new file mode 100644 index 0000000000..338698b036 --- /dev/null +++ b/types/react-svg/react-svg-tests.tsx @@ -0,0 +1,14 @@ +import * as React from 'react'; +import * as ReactDOM from 'react-dom'; +import ReactSVG = require("react-svg"); + +const complete = {}} + className="class-name" + wrapperClassName="wrapper-class-name" + evalScripts="once" + style={{}} + />; + +const minimal = ; diff --git a/types/react-svg/tsconfig.json b/types/react-svg/tsconfig.json new file mode 100644 index 0000000000..43b8246d54 --- /dev/null +++ b/types/react-svg/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "jsx": "react", + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-svg-tests.tsx" + ] +} diff --git a/types/react-svg/tslint.json b/types/react-svg/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/react-svg/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/react-text-mask/index.d.ts b/types/react-text-mask/index.d.ts new file mode 100644 index 0000000000..f4c46bea58 --- /dev/null +++ b/types/react-text-mask/index.d.ts @@ -0,0 +1,36 @@ +// Type definitions for react-text-mask 16.0 +// Project: https://github.com/text-mask/text-mask +// Definitions by: Guilherme Hübner +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import * as React from "react"; + +export type maskArray = Array; + +export interface MaskedInputProps extends React.InputHTMLAttributes { + mask?: maskArray | ((input: HTMLInputElement) => maskArray); + + guide?: boolean; + + placeholderChar?: string; + + keepCharPositions?: boolean; + + pipe?: (conformedValue: string, config: any) => false | string | { value: string, indexesOfPipedChars: number[] }; + + onReject?: (infos: { conformedValue: string, maskRejection: boolean, pipeRejection: boolean }) => void; + + onAccept?: () => void; +} + +export interface conformToMaskResult { + conformedValue: string; + meta: { + someCharsRejected: boolean + }; +} + +export default class MaskedInput extends React.Component {} + +export function conformToMask(text: string, mask: maskArray, config: any): conformToMaskResult; diff --git a/types/react-text-mask/tsconfig.json b/types/react-text-mask/tsconfig.json new file mode 100644 index 0000000000..ca4a35b1cb --- /dev/null +++ b/types/react-text-mask/tsconfig.json @@ -0,0 +1,22 @@ +{ + "files": [ + "index.d.ts" + ], + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + } +} diff --git a/types/react-text-mask/tslint.json b/types/react-text-mask/tslint.json new file mode 100644 index 0000000000..d88586e5bd --- /dev/null +++ b/types/react-text-mask/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/react-truncate/index.d.ts b/types/react-truncate/index.d.ts index cb97ccafe7..15c72616c0 100644 --- a/types/react-truncate/index.d.ts +++ b/types/react-truncate/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-truncate 2.1 +// Type definitions for react-truncate 2.3 // Project: https://github.com/One-com/react-truncate // Definitions by: Matt Perry // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -9,6 +9,7 @@ import * as React from 'react'; export interface TruncateProps extends React.HTMLProps { lines?: number | false; ellipsis?: React.ReactNode; + trimWhitespace?: boolean; onTruncate?(isTruncated: boolean): void; } diff --git a/types/resolve/index.d.ts b/types/resolve/index.d.ts index 11a46b97a3..af32bf4097 100644 --- a/types/resolve/index.d.ts +++ b/types/resolve/index.d.ts @@ -63,40 +63,46 @@ declare function resolveSync(id: string, opts?: resolve.SyncOpts): string; /** * Return whether a package is in core - * - * @param id */ -declare function resolveIsCore(id: string): boolean; +declare function resolveIsCore(id: string): boolean | undefined; declare namespace resolve { interface Opts { - // directory to begin resolving from (defaults to __dirname) + /** directory to begin resolving from (defaults to __dirname) */ basedir?: string; - // package.json data applicable to the module being loaded + /** package.json data applicable to the module being loaded */ package?: any; - // array of file extensions to search in order (defaults to ['.js']) + /** array of file extensions to search in order (defaults to ['.js']) */ extensions?: string | string[]; - // transform the parsed package.json contents before looking at the "main" field + /** transform the parsed package.json contents before looking at the "main" field */ packageFilter?: (pkg: any, pkgfile: string) => any; - // transform a path within a package + /** transform a path within a package */ pathFilter?: (pkg: any, path: string, relativePath: string) => string; - // require.paths array to use if nothing is found on the normal node_modules recursive walk (probably don't use this) + /** require.paths array to use if nothing is found on the normal node_modules recursive walk (probably don't use this) */ paths?: string | string[]; - // directory (or directories) in which to recursively look for modules. (default to 'node_modules') + /** directory (or directories) in which to recursively look for modules. (default to 'node_modules') */ moduleDirectory?: string | string[] + /** + * if true, doesn't resolve `basedir` to real path before resolving. + * This is the way Node resolves dependencies when executed with the --preserve-symlinks flag. + * + * Note: this property is currently true by default but it will be changed to false in the next major version because Node's resolution + * algorithm does not preserve symlinks by default. + */ + preserveSymlinks?: boolean; } export interface AsyncOpts extends Opts { - // how to read files asynchronously (defaults to fs.readFile) + /** how to read files asynchronously (defaults to fs.readFile) */ readFile?: (file: string, cb: readFileCallback) => void; - // function to asynchronously test whether a file exists + /** function to asynchronously test whether a file exists */ isFile?: (file: string, cb: isFileCallback) => void; } export interface SyncOpts extends Opts { - // how to read files synchronously (defaults to fs.readFileSync) + /** how to read files synchronously (defaults to fs.readFileSync) */ readFileSync?: (file: string, charset: string) => string | Buffer; - // function to synchronously test whether a file exists + /** function to synchronously test whether a file exists */ isFile?: (file: string) => boolean; } diff --git a/types/resolve/resolve-tests.ts b/types/resolve/resolve-tests.ts index 1ebaa5bfb4..909d2a77b3 100644 --- a/types/resolve/resolve-tests.ts +++ b/types/resolve/resolve-tests.ts @@ -41,7 +41,8 @@ function test_options_async() { return cb(null, stat.isFile()); } }); - } + }, + preserveSymlinks: false, }, function(error, resolved, pkg) { if (error) { console.error(error.message); @@ -72,7 +73,8 @@ function test_options_sync() { } catch (error) { return false; } - } + }, + preserveSymlinks: true, }); console.log(resolved); resolved = resolve.sync('typescript', { diff --git a/types/roads/index.d.ts b/types/roads/index.d.ts new file mode 100644 index 0000000000..55028403b6 --- /dev/null +++ b/types/roads/index.d.ts @@ -0,0 +1,245 @@ +// Type definitions for roads 5.0 +// Project: https://github.com/Dashron/roads +// Definitions by: Francisco Jesus +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 +/// + +/** + * Roads module + */ +export type Keys = string; +export type Option = {[k in Keys]: any}; + +/** + * @param method The HTTP method that was provided to the request + * @param url The URL that was provided to the request + * @param body The body that was provided to the request, after it was properly parsed into an object + * @param headers The headers that were provided to the request + * @param next The next step of the handler chain + */ +export interface Router { + method: string; + path: string; + fn: () => void; +} + +/** + * @param babelify A set of options that can influence the build process. See all fields below + * @param envify An object to pass to envify. This allows you to change values between your server and client scripts + * @param exclude An array of files that should not be included in the build process + * @param use_sourcemaps Whether or not the build process should include source maps + */ +export interface Options { + babelify?: Option; + envify?: Option; + exclude?: string[]; + external?: any; + use_sourcemaps?: boolean; +} + +/** + * A Road is a container that holds an array of functions + * @see
new Road() + */ +export class Road { + /** + * Add a custom function that will be executed before every request + * @param fn Will be called any time a request is made on the object. + * @see Road.use(Function fn) + */ + use(fn: (method: string, url: any, body: any, headers: Headers, next: () => any) => any): any; + + /** + * Locate and execute the resource method associated with the request parameters + * @param method The request HTTP method + * @param url The request Url + * @param body the request body + * @param headers The request headers + * @see Road.request(string method, string url, dynamic body, Object headers) + */ + request(method: string, url: string, body?: any, headers?: Headers): any; +} + +/** + * The response object contains all of the information you want to send to the client + * @param body The body of the response + * @param status The HTTP Status code + * @param headers Key value pairs of http headers + * @see Road.Response + */ +export class Response { + constructor(body: any, status: number, headers?: Option); + + /** + * Add a cookie method to the response object. Allows you to set cookies + * @param name The name of the cookie + * @param value The value name + * @param options Cookie options + */ + setCookie(name: string, value: string, options?: any): void; + + /** + * Get all the cookies + */ + getCookies(): any; +} + +/** + * A helper error, that contains information relevant to common HTTP errors + * @param message A message describing the HTTP error + * @param code An official http status code + * @see Roads.HttpError + */ +export class HttpError { + invalid_request: number; + unauthorized: number; + forbidden: number; + not_found: number; + method_not_allowed: number; + not_acceptable: number; + conflict: number; + gone: number; + unprocessable_entity: number; + too_many_requests: number; + internal_server_error: number; + constructor(message: string, code: number); +} + +/** + * Middleware object + */ +export namespace middleware { + /** + * Very simple middleware to apply a single value to the request context + * @param key The key that should store the value on the request context + * @param val val The value to apply to the request context + */ + function applyToContext(key: string, val: any): () => any; + + /** + * Middleware to kill the trailing slash on http requests + * @see killSlash() + */ + function killSlash(): any; + + /** + * Middleware to Apply proper cors headers + * @param allow_origins Either * to allow all origins, or an explicit list of valid origins + * @param allow_headers A white list of headers that the client is allowed to send in their requests + */ + function cors(allow_origins: string | string[], allow_headers?: string[]): any; + + /** + * Translate the request body into a usable value + * @param body request body + * @param content_type media type of the body + */ + function parseBody(body: any, content_type: string): object | string; + + /** + * Adds two simple functions to get and set a page title on the request context. This is very helpful for isomorphic js, since on the client, page titles aren't part of the rendered view data. + */ + function setTitle(): any; + + /** + * Applies a method to the request context that allows you to make requests into another roads object + * @param key The name of the key in the request context that will store the roads request + * @param road road The roads object that you will interact with + */ + function reroute(key: string, road: Road): () => any; + + /** + * Middleware to Apply proper cors headers + */ + class SimpleRouter { + /** + * It have all the routers configured + */ + routers: Router[]; + + /** + * @param road The road for the routers + */ + constructor(road?: Road); + + /** + * @param road apply manualy the router middleware + */ + applyMiddleware(road: Road): void; + + /** + * Add a route to receive the request + * @param method Methot to receive the request + * @param path Paht to receive the request + * @param fn Handle the request received + */ + addRoute(method: string, path: string, fn: (url: any, body: any, headers: Headers, next: () => any) => any): any; + + /** + * Receive file request + * @param file_path path of the file to receive + * @param prefix prefix of the path file + */ + addRouteFile(file_path: string, prefix?: string): any; + } +} + +/** + * To integrate to differents HTTP server + */ +export namespace integrations { + /** + * Integration to express + * @param road The Road object that contains all routing information for this integration + */ + function express(road: Road): () => any; + + /** + * Integration to koa + * @param road The Road object that contains all routing information for this integration + */ + function koa(road: Road): () => any; +} + +/** + * A helper object to easily enable PJAX on your website using roads + */ +export class PJAX { + /** + * @param road The road that will turn your pjax requests into HTML + * @param container_element The element that will be filled with your roads output + * @param window The pages window object to help set page title and other items + */ + constructor(road: Road, container_element?: Element | null, window?: Window | null); + + /** + * Adds middleware to the assigned road whcih will adds setTitle to the request context. This allows you to easily update the page title + */ + addTitleMiddleware(): this; + + /** + * Assigns the cookie middlware to the road to properly handle cookies + * @param document The pages document object to properly parse and set cookies + */ + addCookieMiddleware(document: Document): any; + + /** + * Hooks up the PJAX functionality to the information provided via the constructor + */ + register(): any; + + /** + * @param response_object The response from the roads request + */ + render(response_object: object): any; +} + +/** + * Browserify function to convert your script to run in the browser + * @param input_file The source file that will be converted to use in the browser + * @param output_file The output file that will be accessible by your browser + * @param options A set of options that can influence the build process. See all fields below + */ +export function build(input_file: string, output_file: string, options?: Options): any; diff --git a/types/roads/roads-tests.ts b/types/roads/roads-tests.ts new file mode 100644 index 0000000000..6914c3d218 --- /dev/null +++ b/types/roads/roads-tests.ts @@ -0,0 +1,68 @@ +import { build, Road, middleware, integrations, Response, HttpError, PJAX } from "roads"; + +const road = new Road(); +const router = new middleware.SimpleRouter(road); + +road.use(middleware.cors("*")); + +road.use(middleware.killSlash); + +router.addRoute("GET", "/user", (path, body, headers, next) => { + const response = new Response({name: "test"}, 200, {"last-modified": (new Date()).toString()}); + response.setCookie("name", "value", {path: ''}); + response.getCookies(); + return response; +}); + +router.addRouteFile('./example.png', 'http://image-example.com'); + +road.request("GET", "/user") + .then((response: any) => { + console.log(`response: ${JSON.stringify(response)}`); + }); + +road.use((method, url, body, headers, next) => { + return JSON.stringify({ + method, + url, + body, + headers, + next + }); +}); + +road.use((method, url, body, headers, next) => { + // execute the actual resource method, and return the response + return next() + // Catch any errors that are thrown by the resources + .catch ((err: any) => { + // Wrap the errors in response objects. If they are [HttpErrors](#roadshttperror) we adjust the status code + switch (err.code) { + case 404: + return new HttpError(err.massage , 404); + case 405: + return new HttpError(err.massage, 405); + case 500: + default: + return new HttpError(err.massage, 500); + } + }); +}); + +const pjax = new PJAX(road, document.getElementById('container'), window); +pjax.register(); +build(__dirname + '/static/client.js', __dirname + '/static/client.brws.js', { + use_sourcemaps: true, + external: { + roads: { + output_file: __dirname + '/static/roads.brws.js', + }, + react: { + output_file: __dirname + '/static/react.brws.js', + } + }, + babelify: {presets: ['react']} +}); + +const koa = integrations.koa(road); +const express = integrations.express(road); diff --git a/types/roads/tsconfig.json b/types/roads/tsconfig.json new file mode 100644 index 0000000000..ac8a53a641 --- /dev/null +++ b/types/roads/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", + "roads-tests.ts" + ] +} diff --git a/types/roads/tslint.json b/types/roads/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/roads/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/sass-webpack-plugin/index.d.ts b/types/sass-webpack-plugin/index.d.ts new file mode 100644 index 0000000000..df589ca034 --- /dev/null +++ b/types/sass-webpack-plugin/index.d.ts @@ -0,0 +1,32 @@ +// Type definitions for sass-webpack-plugin 1.0 +// Project: https://github.com/jalkoby/sass-webpack-plugin +// Definitions by: AEPKILL +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +import { Options } from 'node-sass'; +import { Plugin } from 'webpack'; + +declare namespace SassPlugin { + type NODE_ENV = 'production' | 'development'; + type FileRule = string | string[] | { [key: string]: string }; + interface Config { + sourceMap?: boolean; + autoprefixer?: boolean; + sass?: Options; + } +} + +declare class SassPlugin extends Plugin { + constructor( + file: SassPlugin.FileRule, + mode?: SassPlugin.NODE_ENV | SassPlugin.Config + ); + constructor( + file: SassPlugin.FileRule, + mode: SassPlugin.NODE_ENV, + config?: SassPlugin.Config + ); +} + +export = SassPlugin; diff --git a/types/sass-webpack-plugin/sass-webpack-plugin-tests.ts b/types/sass-webpack-plugin/sass-webpack-plugin-tests.ts new file mode 100644 index 0000000000..26fc27f4bb --- /dev/null +++ b/types/sass-webpack-plugin/sass-webpack-plugin-tests.ts @@ -0,0 +1,30 @@ +import SassPlugin = require('sass-webpack-plugin'); + +type NODE_ENV = SassPlugin.NODE_ENV; + +const env = process.env.NODE_ENV as NODE_ENV; + +new SassPlugin('./src/styles/index.scss'); + +// production ready +new SassPlugin('./src/styles/index.scss', env); + +// multi files +new SassPlugin(['./src/styles/one.scss', './src/styles/two.sass'], env); + +// a different output filename +new SassPlugin({ './src/styles/index.scss': 'bundle.css' }, env); + +// with sass tuning +new SassPlugin('./src/styles/index.scss', env, { + sass: { + includePaths: ['node_modules/bootstrap-sass/assets/stylesheets'] + } +}); + +// with source maps + compressing - autoprefixing +new SassPlugin('./src/styles/index.scss', { + sourceMap: true, + sass: { outputStyle: 'compressed' }, + autoprefixer: false +}); diff --git a/types/sass-webpack-plugin/tsconfig.json b/types/sass-webpack-plugin/tsconfig.json new file mode 100644 index 0000000000..f062aaeb5d --- /dev/null +++ b/types/sass-webpack-plugin/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6", "dom"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "jsx": "react", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "sass-webpack-plugin-tests.ts"] +} diff --git a/types/sass-webpack-plugin/tslint.json b/types/sass-webpack-plugin/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/sass-webpack-plugin/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/simplebar/index.d.ts b/types/simplebar/index.d.ts index 64533d7408..46b6b9e737 100644 --- a/types/simplebar/index.d.ts +++ b/types/simplebar/index.d.ts @@ -1,9 +1,12 @@ // Type definitions for simplebar.js 2.4 // Project: https://github.com/Grsmto/simplebar -// Definitions by: Leonard Thieu +// Definitions by: Gregor Woiwode , Leonard Thieu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 +export as namespace SimpleBar; +export = SimpleBar; + declare class SimpleBar { static removeObserver(): void; diff --git a/types/simplebar/test/module-tests.ts b/types/simplebar/test/module-tests.ts new file mode 100644 index 0000000000..b7d10d73bf --- /dev/null +++ b/types/simplebar/test/module-tests.ts @@ -0,0 +1,4 @@ +import SimpleBar = require('simplebar'); + +// $ExpectType typeof SimpleBar +SimpleBar; diff --git a/types/simplebar/tsconfig.json b/types/simplebar/tsconfig.json index 467b6358e4..9c51115e84 100644 --- a/types/simplebar/tsconfig.json +++ b/types/simplebar/tsconfig.json @@ -19,6 +19,7 @@ }, "files": [ "index.d.ts", - "simplebar-tests.ts" + "simplebar-tests.ts", + "test/module-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/single-line-log/index.d.ts b/types/single-line-log/index.d.ts new file mode 100644 index 0000000000..ecb60f1d3a --- /dev/null +++ b/types/single-line-log/index.d.ts @@ -0,0 +1,13 @@ +// Type definitions for single-line-log 1.1 +// Project: https://github.com/freeall/single-line-log +// Definitions by: Florian Keller +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface SingleLineLog { + (data: string): void; + clear(): void; + write(data: string): void; +} + +export const stdout: SingleLineLog; +export const stderr: SingleLineLog; diff --git a/types/single-line-log/single-line-log-tests.ts b/types/single-line-log/single-line-log-tests.ts new file mode 100644 index 0000000000..cb1ac0d7c6 --- /dev/null +++ b/types/single-line-log/single-line-log-tests.ts @@ -0,0 +1,19 @@ +/// + +import singleLineLog = require('single-line-log'); +const log = singleLineLog.stderr; + +let i = 0; + +setInterval(() => { + i++; + + const s = `line 1: ${Math.random()}`; + + log(s); + + if (i === 50) { + log.clear(); + process.exit(0); + } +}, 200); diff --git a/types/single-line-log/tsconfig.json b/types/single-line-log/tsconfig.json new file mode 100644 index 0000000000..f353aaca45 --- /dev/null +++ b/types/single-line-log/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", + "single-line-log-tests.ts" + ] +} diff --git a/types/single-line-log/tslint.json b/types/single-line-log/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/single-line-log/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/sinon/index.d.ts b/types/sinon/index.d.ts index f0433a694e..5d3288068d 100644 --- a/types/sinon/index.d.ts +++ b/types/sinon/index.d.ts @@ -353,19 +353,20 @@ declare namespace Sinon { calledThrice(spy: SinonSpy): void; callCount(spy: SinonSpy, count: number): void; callOrder(...spies: SinonSpy[]): void; - calledOn(spy: SinonSpy, obj: any): void; + calledOn(spyOrSpyCall: SinonSpy | SinonSpyCall, obj: any): void; alwaysCalledOn(spy: SinonSpy, obj: any): void; - calledWith(spy: SinonSpy, ...args: any[]): void; + calledWith(spyOrSpyCall: SinonSpy | SinonSpyCall, ...args: any[]): void; alwaysCalledWith(spy: SinonSpy, ...args: any[]): void; neverCalledWith(spy: SinonSpy, ...args: any[]): void; - calledWithExactly(spy: SinonSpy, ...args: any[]): void; + calledWithExactly(spyOrSpyCall: SinonSpy | SinonSpyCall, ...args: any[]): void; alwaysCalledWithExactly(spy: SinonSpy, ...args: any[]): void; - calledWithMatch(spy: SinonSpy, ...args: any[]): void; + calledWithMatch(spyOrSpyCall: SinonSpy | SinonSpyCall, ...args: any[]): void; alwaysCalledWithMatch(spy: SinonSpy, ...args: any[]): void; neverCalledWithMatch(spy: SinonSpy, ...args: any[]): void; - threw(spy: SinonSpy): void; - threw(spy: SinonSpy, exception: string): void; - threw(spy: SinonSpy, exception: any): void; + calledWithNew(spyOrSpyCall: SinonSpy | SinonSpyCall): void; + threw(spyOrSpyCall: SinonSpy | SinonSpyCall): void; + threw(spyOrSpyCall: SinonSpy | SinonSpyCall, exception: string): void; + threw(spyOrSpyCall: SinonSpy | SinonSpyCall, exception: any): void; alwaysThrew(spy: SinonSpy): void; alwaysThrew(spy: SinonSpy, exception: string): void; alwaysThrew(spy: SinonSpy, exception: any): void; diff --git a/types/sinon/sinon-tests.ts b/types/sinon/sinon-tests.ts index 2e2286e538..6ce2254596 100644 --- a/types/sinon/sinon-tests.ts +++ b/types/sinon/sinon-tests.ts @@ -88,6 +88,21 @@ function testNine() { sinon.assert.calledWithMatch(callback, { x: 5 }); sinon.assert.alwaysCalledWithMatch(callback, { y: 5 }); sinon.assert.neverCalledWithMatch(callback, { x: 6 }); + + callback.call("this", "that"); + callback.throws("Error"); + try { + callback(15); + } catch (e) { } + sinon.assert.calledWith(callback.firstCall, { x: 5, y: 5}); + sinon.assert.calledWithExactly(callback.firstCall, { x: 5, y: 5 }); + sinon.assert.calledWithMatch(callback.firstCall, { x: 5 }); + sinon.assert.calledOn(callback.secondCall, "this"); + sinon.assert.threw(callback.thirdCall); + sinon.assert.threw(callback.thirdCall, "Error"); + new (callback as any)(); + sinon.assert.calledWithNew(callback); + sinon.assert.calledWithNew(callback.getCall(4)); } function testAssert() { diff --git a/types/smtp-server/index.d.ts b/types/smtp-server/index.d.ts index 6e71373260..bbcee547e6 100644 --- a/types/smtp-server/index.d.ts +++ b/types/smtp-server/index.d.ts @@ -74,7 +74,11 @@ export interface SMTPServerSession { /** * the IP address for the connected client */ - remoteAddress: SMTPServerAddress; + remoteAddress: string; + /** + * port number the connected client + */ + remotePort: number; /** * reverse resolved hostname for remoteAddress */ @@ -91,6 +95,11 @@ export interface SMTPServerSession { * Envelope Object */ envelope: SMTPServerEnvelope; + /** + * If true, then the connection is using TLS + */ + secure: boolean; + transmissionType: string; tlsOptions: tls.TlsOptions; @@ -100,7 +109,7 @@ export interface SMTPServerEnvelope { /** * includes an address object or is set to false */ - mailFrom: SMTPServerAddress; + mailFrom: SMTPServerAddress | false; /** * includes an array of address objects */ diff --git a/types/spotify-web-playback-sdk/index.d.ts b/types/spotify-web-playback-sdk/index.d.ts index 95d8375b56..ee3086e40e 100644 --- a/types/spotify-web-playback-sdk/index.d.ts +++ b/types/spotify-web-playback-sdk/index.d.ts @@ -1,6 +1,8 @@ // Type definitions for spotify-web-playback-sdk 0.1 // Project: https://beta.developer.spotify.com/documentation/web-playback-sdk/reference/ // Definitions by: Festify Dev Team +// Marcus Weiner +// Moritz Gunz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface Window { @@ -86,6 +88,10 @@ declare namespace Spotify { FULL_REPEAT = 2, } + type ErrorListener = (err: Error) => void; + type PlaybackInstanceListener = (inst: WebPlaybackInstance) => void; + type PlaybackStateListener = (s: PlaybackState) => void; + class SpotifyPlayer { constructor(options: PlayerInit); @@ -95,9 +101,17 @@ declare namespace Spotify { getVolume(): Promise; nextTrack(): Promise; - on(event: 'ready', cb: (pb: WebPlaybackInstance) => void): void; - on(event: 'player_state_changed', cb: (pb: PlaybackState) => void): void; - on(event: ErrorTypes, cb: (err: Error) => void): void; + addListener(event: 'ready', cb: PlaybackInstanceListener): void; + addListener(event: 'player_state_changed', cb: PlaybackStateListener): void; + addListener(event: ErrorTypes, cb: ErrorListener): void; + on(event: 'ready', cb: PlaybackInstanceListener): void; + on(event: 'player_state_changed', cb: PlaybackStateListener): void; + on(event: ErrorTypes, cb: ErrorListener): void; + + removeListener( + event: 'ready' | 'player_state_changed' | ErrorTypes, + cb?: ErrorListener | PlaybackInstanceListener | PlaybackStateListener, + ): void; pause(): Promise; previousTrack(): Promise; diff --git a/types/spotify-web-playback-sdk/spotify-web-playback-sdk-tests.ts b/types/spotify-web-playback-sdk/spotify-web-playback-sdk-tests.ts index afb82ef994..8f2c27f33d 100644 --- a/types/spotify-web-playback-sdk/spotify-web-playback-sdk-tests.ts +++ b/types/spotify-web-playback-sdk/spotify-web-playback-sdk-tests.ts @@ -5,14 +5,14 @@ const player = new Spotify.Player({ name: "Carly Rae Jepsen Player", - getOAuthToken: (callback) => { + getOAuthToken: (callback: (t: string) => void) => { // Run code to get a fresh access token callback("access token here"); }, volume: 0.5 }); -player.connect().then((success) => { +player.connect().then((success: boolean) => { if (success) { console.log("The Web Playback SDK successfully connected to Spotify!"); } @@ -20,11 +20,11 @@ player.connect().then((success) => { player.disconnect(); -player.on("ready", (data) => { +player.addListener("ready", (data) => { console.log("The Web Playback SDK is ready to play music!"); }); -player.getCurrentState().then((playbackState) => { +player.getCurrentState().then((playbackState: Spotify.PlaybackState | null) => { if (playbackState) { const { current_track, next_tracks } = playbackState.track_window; @@ -35,7 +35,7 @@ player.getCurrentState().then((playbackState) => { } }); -player.getVolume().then((volume) => { +player.getVolume().then((volume: number) => { const volume_percentage = (volume * 100); console.log(`The volume of the player is ${volume_percentage}%`); }); @@ -68,12 +68,12 @@ player.nextTrack().then(() => { console.log("Skipped to next track!"); }); -player.on("ready", (data) => { +player.on("ready", (data: Spotify.WebPlaybackInstance) => { const { device_id } = data; console.log("Connected with Device ID", device_id); }); -player.on("player_state_changed", (playbackState) => { +player.on("player_state_changed", (playbackState: Spotify.PlaybackState) => { const { position, duration } = playbackState; const { current_track } = playbackState.track_window; @@ -82,18 +82,24 @@ player.on("player_state_changed", (playbackState) => { console.log("Duration of Song", duration); }); -player.on('initialization_error', (e) => { +player.addListener('initialization_error', (e: Spotify.Error) => { console.error("Failed to initialize", e.message); }); -player.on('authentication_error', (e) => { +player.addListener('authentication_error', (e: Spotify.Error) => { console.error("Failed to authenticate", e.message); }); -player.on('account_error', (e) => { +player.addListener('account_error', (e: Spotify.Error) => { console.error("Failed to validate Spotify account", e.message); }); -player.on('playback_error', (e) => { +const listener = (e: Spotify.Error) => { console.error("Failed to perform playback", e.message); -}); +}; +player.addListener('playback_error', listener); +player.addListener('playback_error', () => {}); +player.removeListener('playback_error', () => {}); + +player.removeListener('playback_error'); +player.removeListener('playback_error', listener); diff --git a/types/storybook__addon-links/index.d.ts b/types/storybook__addon-links/index.d.ts index 141072aa2a..72ec6aa296 100644 --- a/types/storybook__addon-links/index.d.ts +++ b/types/storybook__addon-links/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for @storybook/addon-links 3.0 +// Type definitions for @storybook/addon-links 3.3 // Project: https://github.com/storybooks/storybook -// Definitions by: Joscha Feth +// Definitions by: Joscha Feth , +// Jesse Pinho // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.6 @@ -9,3 +10,5 @@ import * as React from 'react'; export type LinkToFunction = (...args: any[]) => string; export function linkTo(book: string | LinkToFunction, kind?: string | LinkToFunction): React.MouseEventHandler; + +export function hrefTo(kind: string, story: string): Promise; diff --git a/types/storybook__addon-links/storybook__addon-links-tests.tsx b/types/storybook__addon-links/storybook__addon-links-tests.tsx index 2f138daf20..e922b0fc00 100644 --- a/types/storybook__addon-links/storybook__addon-links-tests.tsx +++ b/types/storybook__addon-links/storybook__addon-links-tests.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import { storiesOf } from '@storybook/react'; -import { linkTo } from '@storybook/addon-links'; +import { hrefTo, linkTo } from '@storybook/addon-links'; storiesOf('Button', module) .add('First', () => ( @@ -12,3 +12,5 @@ storiesOf('Button', module) .add('With function', () => ( )); + +hrefTo('Button', 'First').then(link => link); diff --git a/types/stripe-v3/index.d.ts b/types/stripe-v3/index.d.ts index 76666e747a..55cc5962df 100644 --- a/types/stripe-v3/index.d.ts +++ b/types/stripe-v3/index.d.ts @@ -12,18 +12,23 @@ declare var Stripe: stripe.StripeStatic; declare namespace stripe { interface StripeStatic { - (publicKey: string): Stripe; + (publicKey: string, options?: StripeOptions): Stripe; version: number; } interface Stripe { elements(options?: elements.ElementsCreateOptions): elements.Elements; createToken(element: elements.Element, options?: TokenOptions): Promise; + createToken(name: 'bank_account', options: BankAccountTokenOptions): Promise; + createToken(name: 'pii', options: PiiTokenOptions): Promise; + createSource(element: elements.Element, options?: {owner?: OwnerInfo}): Promise; createSource(options: SourceOptions): Promise; + retrieveSource(options: RetrieveSourceOptions): Promise; + paymentRequest(options: paymentRequest.StripePaymentRequestOptions): paymentRequest.StripePaymentRequest; } interface StripeOptions { - stripeAccount: string; + stripeAccount?: string; } interface TokenOptions { @@ -37,6 +42,33 @@ declare namespace stripe { currency?: string; } + interface BankAccountTokenOptions { + country: string; + currency: string; + routing_number: string; + account_number: string; + account_holder_name: string; + account_holder_type: string; + } + + interface PiiTokenOptions { + personal_id_number: string; + } + + interface OwnerInfo { + address?: { + city?: string; + country?: string; + line1?: string; + line2?: string; + postal_code?: string; + state?: string; + }; + name?: string; + email?: string; + phone?: string; + } + interface SourceOptions { type: string; flow?: 'redirect' | 'receiver' | 'code_verification' | 'none'; @@ -45,19 +77,7 @@ declare namespace stripe { }; currency?: string; amount?: number; - owner?: { - address?: { - city?: string; - country?: string; - line1?: string; - line2?: string; - postal_code?: string; - state?: string; - }; - name?: string; - email?: string; - phone?: string; - }; + owner?: OwnerInfo; metadata?: {}; statement_descriptor?: string; redirect?: { @@ -65,6 +85,9 @@ declare namespace stripe { }; token?: string; usage?: 'reusable' | 'single_use'; + three_d_secure?: { + card: string; + }; } interface Token { @@ -106,6 +129,15 @@ declare namespace stripe { last4: string; mandate_reference: string; }; + card?: Card; + status?: string; + redirect?: { + status: string; + url: string; + }; + three_d_secure?: { + authenticated: boolean; + }; } interface SourceResponse { @@ -165,6 +197,84 @@ declare namespace stripe { metadata: any; name?: string; tokenization_method?: tokenizationType; + three_d_secure?: 'required' | 'recommended' | 'optional' | 'not_supported'; + } + + interface RetrieveSourceOptions { + id: string; + client_secret: string; + } + + // Container for all payment request related types + namespace paymentRequest { + interface DisplayItem { + amount: number; + label: string; + pending?: boolean; + } + + interface StripePaymentRequestUpdateOptions { + currency: string; + total: DisplayItem; + displayItems?: DisplayItem[]; + shippingOptions?: ShippingOption[]; + } + + interface StripePaymentRequestOptions extends StripePaymentRequestUpdateOptions { + country: string; + requestPayerName?: boolean; + requestPayerEmail?: boolean; + requestPayerPhone?: boolean; + requestShipping?: boolean; + } + + interface UpdateDetails { + status: 'success' | 'fail' | 'invalid_shipping_address'; + total?: DisplayItem; + displayItems?: DisplayItem[]; + shippingOptions?: ShippingOption[]; + } + + interface ShippingOption { + id: string; + label: string; + detail?: string; + amount: number; + } + + interface ShippingAddress { + country: string; + addressLine: string[]; + region: string; + city: string; + postalCode: string; + recipient: string; + phone: string; + sortingCode?: string; + dependentLocality?: string; + } + + interface StripePaymentResponse { + token?: Token; + source?: Source; + complete: (status: string) => void; + payerName?: string; + payerEmail?: string; + payerPhone?: string; + shippingAddress?: ShippingAddress; + shippingOption?: ShippingOption; + methodName: string; + } + + interface StripePaymentRequest { + canMakePayment(): Promise<{applePay?: boolean} | null>; + show(): void; + update(options: StripePaymentRequestUpdateOptions): void; + on(event: 'token' | 'source', handler: (response: StripePaymentResponse) => void): void; + on(event: 'cancel', handler: () => void): void; + on(event: 'shippingaddresschange', handler: (response: {updateWith: (options: UpdateDetails) => void, shippingAddress: ShippingAddress}) => void): void; + on(event: 'shippingoptionchange', handler: (response: {updateWith: (options: UpdateDetails) => void, shippingOption: ShippingOption}) => void): void; + } } // Container for all elements related types @@ -181,6 +291,7 @@ declare namespace stripe { // Cannot find name 'HTMLElement' mount(domElement: any): void; on(event: eventTypes, handler: handler): void; + on(event: 'click', handler: (response: {preventDefault: () => void}) => void): void; focus(): void; blur(): void; clear(): void; @@ -202,9 +313,9 @@ declare namespace stripe { locale?: string; } - type elementsType = 'card' | 'cardNumber' | 'cardExpiry' | 'cardCvc' | 'postalCode'; + type elementsType = 'card' | 'cardNumber' | 'cardExpiry' | 'cardCvc' | 'postalCode' | 'paymentRequestButton'; interface Elements { - create(type: elementsType, options: ElementsOptions): Element; + create(type: elementsType, options?: ElementsOptions): Element; } interface ElementsOptions { @@ -219,13 +330,16 @@ declare namespace stripe { hidePostalCode?: boolean; hideIcon?: boolean; iconStyle?: 'solid' | 'default'; + placeholder?: string; style?: { base?: Style; complete?: Style; empty?: Style; invalid?: Style; + paymentRequestButton?: PaymentRequestButtonStyleOptions; }; value?: string | { [objectKey: string]: string; }; + paymentRequest?: paymentRequest.StripePaymentRequest; } interface Style extends StyleOptions { @@ -234,11 +348,13 @@ declare namespace stripe { '::placeholder'?: StyleOptions; '::selection'?: StyleOptions; ':-webkit-autofill'?: StyleOptions; + '::-ms-clear'?: StyleOptions; } interface Font { family?: string; src?: string; + display?: string; style?: string; unicodeRange?: string; weight?: string; @@ -255,9 +371,16 @@ declare namespace stripe { iconColor?: string; lineHeight?: string; letterSpacing?: string; + textAlign?: string; textDecoration?: string; textShadow?: string; textTransform?: string; } + + interface PaymentRequestButtonStyleOptions { + type?: 'default' | 'donate' | 'buy'; + theme: 'dark' | 'light' | 'light-outline'; + height: string; + } } } diff --git a/types/stripe-v3/stripe-v3-tests.ts b/types/stripe-v3/stripe-v3-tests.ts index ccf86e5215..201bad8678 100644 --- a/types/stripe-v3/stripe-v3-tests.ts +++ b/types/stripe-v3/stripe-v3-tests.ts @@ -42,7 +42,93 @@ describe("Stripe", () => { (error: stripe.Error) => { console.error(error); }); + // test 3D secure + const threeDSecureFrame = document.getElementById('3d-secure-frame'); + const ownerInfo = { + name: 'Jimmy', + address: { + line1: '1 High Street', + postal_code: 'XYZ' + } + }; + stripe.createSource(card, { owner: ownerInfo }).then(result => { + if (result.error) { + // handle error + return Promise.resolve(null); + } + if (!result.source) { + // handle error + return Promise.resolve(null); + } + if (!result.source.card || result.source.card.three_d_secure === 'not_supported') { + // make regular payment... + return Promise.resolve(null); + } + return stripe.createSource({ + type: 'three_d_secure', + amount: 100, + currency: 'usd', + three_d_secure: { + card: result.source.id + }, + redirect: { + return_url: location.origin + '/3d-secure-processing-page' + } + }); + }).then(threeDSource => { + if (!threeDSource) { + return Promise.resolve(null); + } + if (threeDSource.error) { + if (threeDSource.error.code === 'payment_method_not_available') { + // make regular payment... + return Promise.resolve(null); + } + // handle error + return Promise.resolve(null); + } + if (!threeDSource.source || threeDSource.source.status === 'failed' || !threeDSource.source.redirect) { + // make regular payment... + return Promise.resolve(null); + } + if (threeDSource.source.status === 'chargeable') { + // make charge... + return Promise.resolve(null); + } + threeDSecureFrame.setAttribute('src', threeDSource.source.redirect.url); + // now wait until chargeable then make the charge + return Promise.resolve(null); + }); card.destroy(); + // test payment request + const paymentRequest = stripe.paymentRequest({ + country: 'US', + currency: 'usd', + total: { + label: 'Demo total', + amount: 1000, + } + }); + const prButton = elements.create('paymentRequestButton', { paymentRequest }); + paymentRequest.canMakePayment().then(result => { + if (result) { + prButton.mount('#payment-request-button'); + } else { + document.getElementById('payment-request-button')!.style.display = 'none'; + } + }); + paymentRequest.on('token', ev => { + const body = JSON.stringify({token: ev.token!.id}); + // post to server... + Promise.resolve({ok: true}) + .then(response => { + if (response.ok) { + ev.complete('success'); + } else { + ev.complete('fail'); + } + }); + }); }); }); diff --git a/types/structured-source/index.d.ts b/types/structured-source/index.d.ts new file mode 100644 index 0000000000..ce7325cf9d --- /dev/null +++ b/types/structured-source/index.d.ts @@ -0,0 +1,29 @@ +// Type definitions for structured-source 3.0 +// Project: https://github.com/Constellation/structured-source +// Definitions by: azu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace StructuredSource { + interface SourcePosition { + // Line number starts with 1. + line: number; + // Column number starts with 0. + column: number; + } + interface SourceLocation { + start: SourcePosition; + end: SourcePosition; + } +} + +declare class StructuredSource { + /** + * @param source - source code text. + */ + constructor(source: string); + locationToRange(loc: StructuredSource.SourceLocation): [number, number]; + rangeToLocation(range: [number, number]): StructuredSource.SourceLocation; + positionToIndex(pos: StructuredSource.SourcePosition): number; + indexToPosition(index: number): StructuredSource.SourcePosition; +} +export = StructuredSource; diff --git a/types/structured-source/structured-source-tests.ts b/types/structured-source/structured-source-tests.ts new file mode 100644 index 0000000000..cda6e99af2 --- /dev/null +++ b/types/structured-source/structured-source-tests.ts @@ -0,0 +1,15 @@ +import StructuredSource = require('structured-source'); + +const src = new StructuredSource('aaa\u2028aaaa\u2029aaaaa\n'); + +// $ExpectType: number +src.positionToIndex({ line: 1, column: 2 }); +// $ExpectType: { line: number, column: number } +src.indexToPosition(2); +// $ExpectType: { start: { line: number, column: number}, end: { line: number, column: number } } +src.rangeToLocation([0, 2]); +// $ExpectType: [ number, number ] +src.locationToRange({ + start: { line: 1, column: 0 }, + end: { line: 1, column: 2 } +}); diff --git a/types/structured-source/tsconfig.json b/types/structured-source/tsconfig.json new file mode 100644 index 0000000000..f0d949503e --- /dev/null +++ b/types/structured-source/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", + "structured-source-tests.ts" + ] +} diff --git a/types/structured-source/tslint.json b/types/structured-source/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/structured-source/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/swagger-express-mw/tsconfig.json b/types/swagger-express-mw/tsconfig.json index 1d597728f7..de623e0eca 100644 --- a/types/swagger-express-mw/tsconfig.json +++ b/types/swagger-express-mw/tsconfig.json @@ -17,8 +17,14 @@ "boom": [ "boom/v4" ], + "catbox": [ + "catbox/v7" + ], "hapi": [ "hapi/v16" + ], + "inert": [ + "inert/v4" ] }, "noEmit": true, @@ -28,4 +34,4 @@ "index.d.ts", "swagger-express-mw-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/swagger-hapi/tsconfig.json b/types/swagger-hapi/tsconfig.json index 410688bcf1..0b6f0cf5ed 100644 --- a/types/swagger-hapi/tsconfig.json +++ b/types/swagger-hapi/tsconfig.json @@ -17,8 +17,14 @@ "boom": [ "boom/v4" ], + "catbox": [ + "catbox/v7" + ], "hapi": [ "hapi/v16" + ], + "inert": [ + "inert/v4" ] }, "noEmit": true, @@ -28,4 +34,4 @@ "index.d.ts", "swagger-hapi-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/swagger-node-runner/tsconfig.json b/types/swagger-node-runner/tsconfig.json index e559433107..43f153e823 100644 --- a/types/swagger-node-runner/tsconfig.json +++ b/types/swagger-node-runner/tsconfig.json @@ -17,8 +17,14 @@ "boom": [ "boom/v4" ], + "catbox": [ + "catbox/v7" + ], "hapi": [ "hapi/v16" + ], + "inert": [ + "inert/v4" ] }, "noEmit": true, @@ -28,4 +34,4 @@ "index.d.ts", "swagger-node-runner-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/swagger-restify-mw/tsconfig.json b/types/swagger-restify-mw/tsconfig.json index 8c5f09a930..89ba456bbf 100644 --- a/types/swagger-restify-mw/tsconfig.json +++ b/types/swagger-restify-mw/tsconfig.json @@ -17,8 +17,14 @@ "boom": [ "boom/v4" ], + "catbox": [ + "catbox/v7" + ], "hapi": [ "hapi/v16" + ], + "inert": [ + "inert/v4" ] }, "noEmit": true, @@ -28,4 +34,4 @@ "index.d.ts", "swagger-restify-mw-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/swagger-sails-hook/tsconfig.json b/types/swagger-sails-hook/tsconfig.json index 508453b078..0fd1188f61 100644 --- a/types/swagger-sails-hook/tsconfig.json +++ b/types/swagger-sails-hook/tsconfig.json @@ -17,8 +17,14 @@ "boom": [ "boom/v4" ], + "catbox": [ + "catbox/v7" + ], "hapi": [ "hapi/v16" + ], + "inert": [ + "inert/v4" ] }, "noEmit": true, @@ -28,4 +34,4 @@ "index.d.ts", "swagger-sails-hook-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index 3ba0be89e8..a5e2b6486c 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -271,7 +271,7 @@ export class AnimationClip { optimize(): AnimationClip; static CreateFromMorphTargetSequence( name: string, morphTargetSequence: MorphTarget[], fps: number, noLoop: boolean ): AnimationClip; - static findByName( clipArray: AnimationClip, name: string ): AnimationClip; + static findByName( clipArray: AnimationClip[], name: string ): AnimationClip; static CreateClipsFromMorphTargetSequences( morphTargets: MorphTarget[], fps: number, noLoop: boolean ): AnimationClip[]; static parse( json: any ): AnimationClip; static parseAnimation( animation: any, bones: Bone[], nodeName: string ): AnimationClip; @@ -286,7 +286,7 @@ export class AnimationMixer extends EventDispatcher { clipAction(clip: AnimationClip, root?: any): AnimationAction; existingAction(clip: AnimationClip, root?: any): AnimationAction; - stopAllAction(clip: AnimationClip, root?: any): AnimationMixer; + stopAllAction(): AnimationMixer; update(deltaTime: number): AnimationMixer; getRoot(): any; uncacheClip(clip: AnimationClip): void; diff --git a/types/vision/tsconfig.json b/types/vision/tsconfig.json index 8f34e356c5..3c6377bfea 100644 --- a/types/vision/tsconfig.json +++ b/types/vision/tsconfig.json @@ -13,11 +13,6 @@ "../" ], "types": [], - "paths": { - "boom": [ - "boom/v4" - ] - }, "noEmit": true, "forceConsistentCasingInFileNames": true }, diff --git a/types/vision/v4/tsconfig.json b/types/vision/v4/tsconfig.json index bee5c542c4..832edc4057 100644 --- a/types/vision/v4/tsconfig.json +++ b/types/vision/v4/tsconfig.json @@ -17,9 +17,15 @@ "boom": [ "boom/v4" ], + "catbox": [ + "catbox/v7" + ], "hapi": [ "hapi/v16" ], + "inert": [ + "inert/v4" + ], "vision": [ "vision/v4" ] diff --git a/types/vnu-jar/index.d.ts b/types/vnu-jar/index.d.ts new file mode 100644 index 0000000000..2e2e2a1ac9 --- /dev/null +++ b/types/vnu-jar/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for vnu-jar 17.11 +// Project: https://github.com/validator/validator#readme +// Definitions by: Umoxfo +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = vnu_jar; + +declare const vnu_jar: string; diff --git a/types/vnu-jar/tsconfig.json b/types/vnu-jar/tsconfig.json new file mode 100644 index 0000000000..8468e98846 --- /dev/null +++ b/types/vnu-jar/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "vnu-jar-tests.ts" + ] +} diff --git a/types/vnu-jar/tslint.json b/types/vnu-jar/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/vnu-jar/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/vnu-jar/vnu-jar-tests.ts b/types/vnu-jar/vnu-jar-tests.ts new file mode 100644 index 0000000000..776ccd9d4a --- /dev/null +++ b/types/vnu-jar/vnu-jar-tests.ts @@ -0,0 +1,15 @@ +// Imported from: https://github.com/soywiz/typescript-node-definitions/d.ts + +/// + +import { exec } from "child_process"; +import vnu = require("vnu-jar"); + +exec(`java -jar ${vnu} --version`, (error, stdout) => { + if (error) { + console.error(`exec error: ${error}`); + return; + } + + console.log(stdout); +}); diff --git a/types/web-animations-js/index.d.ts b/types/web-animations-js/index.d.ts index 2424e93e92..54c0b8c01b 100644 --- a/types/web-animations-js/index.d.ts +++ b/types/web-animations-js/index.d.ts @@ -5,13 +5,12 @@ type AnimationEffectTimingFillMode = "none" | "forwards" | "backwards" | "both" | "auto"; type AnimationEffectTimingPlaybackDirection = "normal" | "reverse" | "alternate" | "alternate-reverse"; -type AnimationPlayState = "idle" | "pending" | "running" | "paused" | "finished"; +type AnimationPlayState = "idle" | "running" | "paused" | "finished"; -declare class AnimationPlaybackEvent { - constructor(target: Animation, currentTime: number, timelineTime: number); +interface AnimationPlaybackEvent { target: Animation; - currentTime: number; - timelineTime: number; + readonly currentTime: number | null; + readonly timelineTime: number | null; type: string; bubbles: boolean; cancelable: boolean; @@ -21,14 +20,26 @@ declare class AnimationPlaybackEvent { timeStamp: number; } +interface AnimationPlaybackEventInit extends EventInit { + currentTime?: number | null; + timelineTime?: number | null; +} + +declare var AnimationPlaybackEvent: { + prototype: AnimationPlaybackEvent; + new(type: string, eventInitDict?: AnimationPlaybackEventInit): AnimationPlaybackEvent; +}; + interface AnimationKeyFrame { - easing?: string; - offset?: number; - [key: string]: string | number | [string | number, string | number] | undefined; + easing?: string | string[]; + offset?: number | Array | null; + opacity?: number | number[]; + transform?: string | string[]; + // [key: string]: string | number | [string | number, string | number] | undefined; (duplicate string indexer in TypeScript 2.7+) } interface AnimationTimeline { - currentTime: number; + readonly currentTime: number | null; getAnimations(): Animation[]; play(effect: KeyframeEffect): Animation; } @@ -43,21 +54,35 @@ interface AnimationEffectTiming { iterations?: number; playbackRate?: number; } -declare class KeyframeEffect { + +interface AnimationEffectReadOnly { + readonly timing: number; + getComputedTiming(): ComputedTimingProperties; +} + +interface ComputedTimingProperties { + endTime: number; + activeDuration: number; + localTime: number | null; + progress: number | null; + currentIteration: number | null; +} + +declare class KeyframeEffect implements AnimationEffectReadOnly { constructor(target: HTMLElement, effect: AnimationKeyFrame | AnimationKeyFrame[], timing: number | AnimationEffectTiming, id?: string); activeDuration: number; onsample: (timeFraction: number | null, effect: KeyframeEffect, animation: Animation) => void | undefined; parent: KeyframeEffect | null; target: HTMLElement; - timing: AnimationEffectTiming; + timing: number; + getComputedTiming(): ComputedTimingProperties; getFrames(): AnimationKeyFrame[]; remove(): void; } -type AnimationEventListener = (evt: AnimationPlaybackEvent) => void; +type AnimationEventListener = (this: Animation, evt: AnimationPlaybackEvent) => any; -declare class Animation { - constructor(effect: KeyframeEffect, timeline?: AnimationTimeline); - currentTime: number; +interface Animation extends EventTarget { + currentTime: number | null; id: string; oncancel: AnimationEventListener; onfinish: AnimationEventListener; @@ -69,14 +94,19 @@ declare class Animation { pause(): void; play(): void; reverse(): void; - addEventListener(type: "finish" | "cancel", handler: AnimationEventListener): void; - removeEventListener(type: "finish" | "cancel", handler: AnimationEventListener): void; - effect: KeyframeEffect; + addEventListener(type: "finish" | "cancel", handler: EventListener): void; + removeEventListener(type: "finish" | "cancel", handler: EventListener): void; + effect: AnimationEffectReadOnly; readonly finished: Promise; readonly ready: Promise; timeline: AnimationTimeline; } +declare var Animation: { + prototype: Animation; + new(effect?: AnimationEffectReadOnly, timeline?: AnimationTimeline): Animation; +}; + declare class SequenceEffect extends KeyframeEffect { constructor(effects: KeyframeEffect[]); } diff --git a/types/yar/tsconfig.json b/types/yar/tsconfig.json index 3843d1296e..c2723ded55 100644 --- a/types/yar/tsconfig.json +++ b/types/yar/tsconfig.json @@ -13,11 +13,6 @@ "../" ], "types": [], - "paths": { - "boom": [ - "boom/v4" - ] - }, "noEmit": true, "forceConsistentCasingInFileNames": true }, diff --git a/types/yauzl/index.d.ts b/types/yauzl/index.d.ts new file mode 100644 index 0000000000..c0e8b5dc88 --- /dev/null +++ b/types/yauzl/index.d.ts @@ -0,0 +1,97 @@ +// Type definitions for yauzl 2.9 +// Project: https://github.com/thejoshwolfe/yauzl +// Definitions by: Florian Keller +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import { EventEmitter } from 'events'; +import { Readable } from 'stream'; + +export abstract class RandomAccessReader extends EventEmitter { + _readStreamForRange(start: number, end: number): void; + createReadStream(options: { start: number; end: number }): void; + read(buffer: Buffer, offset: number, length: number, position: number, callback: (err?: Error) => void): void; + close(callback: (err?: Error) => void): void; +} + +export class Entry { + comment: string; + compressedSize: number; + compressionMethod: number; + crc32: number; + externalFileAttributes: number; + extraFieldLength: number; + extraFields: Array<{ id: number; data: Buffer }>; + fileCommentLength: number; + fileName: string; + fileNameLength: number; + generalPurposeBitFlag: number; + internalFileAttributes: number; + lastModFileDate: number; + lastModFileTime: number; + relativeOffsetOfLocalHeader: number; + uncompressedSize: number; + versionMadeBy: number; + versionNeededToExtract: number; + + getLastModDate(): Date; + isEncrypted(): boolean; + isCompressed(): boolean; +} + +export interface ZipFileOptions { + decompress: boolean | null; + decrypt: boolean | null; + start: number | null; + end: number | null; +} + +export class ZipFile extends EventEmitter { + autoClose: boolean; + comment: string; + decodeStrings: boolean; + emittedError: boolean; + entriesRead: number; + entryCount: number; + fileSize: number; + isOpen: boolean; + lazyEntries: boolean; + readEntryCursor: boolean; + validateEntrySizes: boolean; + + constructor( + reader: RandomAccessReader, + centralDirectoryOffset: number, + fileSize: number, + entryCount: number, + comment: string, + autoClose: boolean, + lazyEntries: boolean, + decodeStrings: boolean, + validateEntrySizes: boolean, + ); + + openReadStream(entry: Entry, options: ZipFileOptions, callback: (err?: Error, stream?: Readable) => void): void; + openReadStream(entry: Entry, callback: (err?: Error, stream?: Readable) => void): void; + close(): void; + readEntry(): void; +} + +export interface Options { + autoClose?: boolean; + lazyEntries?: boolean; + decodeStrings?: boolean; + validateEntrySizes?: boolean; +} + +export function open(path: string, options: Options, callback?: (err?: Error, zipfile?: ZipFile) => void): void; +export function open(path: string, callback?: (err?: Error, zipfile?: ZipFile) => void): void; +export function fromFd(fd: number, options: Options, callback?: (err?: Error, zipfile?: ZipFile) => void): void; +export function fromFd(fd: number, callback?: (err?: Error, zipfile?: ZipFile) => void): void; +export function fromBuffer(buffer: Buffer, options: Options, callback?: (err?: Error, zipfile?: ZipFile) => void): void; +export function fromBuffer(buffer: Buffer, callback?: (err?: Error, zipfile?: ZipFile) => void): void; +export function fromRandomAccessReader(reader: RandomAccessReader, totalSize: number, options: Options, callback: (err?: Error, zipfile?: ZipFile) => void): void; +export function fromRandomAccessReader(reader: RandomAccessReader, totalSize: number, callback: (err?: Error, zipfile?: ZipFile) => void): void; +export function dosDateTimeToDate(date: number, time: number): Date; +export function validateFileName(fileName: string): string | null; diff --git a/types/yauzl/tsconfig.json b/types/yauzl/tsconfig.json new file mode 100644 index 0000000000..4ed78c552b --- /dev/null +++ b/types/yauzl/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", + "yauzl-tests.ts" + ] +} diff --git a/types/yauzl/tslint.json b/types/yauzl/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/yauzl/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/yauzl/yauzl-tests.ts b/types/yauzl/yauzl-tests.ts new file mode 100644 index 0000000000..89dc69df30 --- /dev/null +++ b/types/yauzl/yauzl-tests.ts @@ -0,0 +1,28 @@ +import * as yauzl from 'yauzl'; +import { Writable } from 'stream'; + +yauzl.open('path/to/file.zip', {lazyEntries: true}, (err, zipfile) => { + if (err) { + throw err; + } + if (zipfile) { + zipfile.readEntry(); + zipfile.on('entry', entry => { + if (/\/$/.test(entry.fileName)) { + zipfile.readEntry(); + } else { + zipfile.openReadStream(entry, (err, readStream) => { + if (err) { + throw err; + } + if (readStream) { + readStream.on('end', () => { + zipfile.readEntry(); + }); + readStream.pipe(new Writable()); + } + }); + } + }); + } +});