Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

es5-lib.ts 200KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459
  1. /* eslint-disable */
  2. // HEY! DO NOT MODIFY THIS FILE.
  3. export default {
  4. name: 'es5-lib.d.ts',
  5. content: `
  6. /*! *****************************************************************************
  7. Copyright (c) Microsoft Corporation. All rights reserved.
  8. Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  9. this file except in compliance with the License. You may obtain a copy of the
  10. License at http://www.apache.org/licenses/LICENSE-2.0
  11. THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  12. KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  13. WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  14. MERCHANTABLITY OR NON-INFRINGEMENT.
  15. See the Apache Version 2.0 License for specific language governing permissions
  16. and limitations under the License.
  17. ***************************************************************************** */
  18. /// <reference no-default-lib="true"/>
  19. /////////////////////////////
  20. /// ECMAScript APIs
  21. /////////////////////////////
  22. declare let NaN: number
  23. declare let Infinity: number
  24. /**
  25. * Evaluates JavaScript code and executes it.
  26. * @param x A String value that contains valid JavaScript code.
  27. */
  28. declare function eval(x: string): any
  29. /**
  30. * Converts a string to an integer.
  31. * @param string A string to convert into a number.
  32. * @param radix A value between 2 and 36 that specifies the base of the number in \`string\`.
  33. * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.
  34. * All other strings are considered decimal.
  35. */
  36. declare function parseInt(string: string, radix?: number): number
  37. /**
  38. * Converts a string to a floating-point number.
  39. * @param string A string that contains a floating-point number.
  40. */
  41. declare function parseFloat(string: string): number
  42. /**
  43. * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number).
  44. * @param number A numeric value.
  45. */
  46. declare function isNaN(number: number): boolean
  47. /**
  48. * Determines whether a supplied number is finite.
  49. * @param number Any numeric value.
  50. */
  51. declare function isFinite(number: number): boolean
  52. /**
  53. * Gets the unencoded version of an encoded Uniform Resource Identifier (URI).
  54. * @param encodedURI A value representing an encoded URI.
  55. */
  56. declare function decodeURI(encodedURI: string): string
  57. /**
  58. * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI).
  59. * @param encodedURIComponent A value representing an encoded URI component.
  60. */
  61. declare function decodeURIComponent(encodedURIComponent: string): string
  62. /**
  63. * Encodes a text string as a valid Uniform Resource Identifier (URI)
  64. * @param uri A value representing an encoded URI.
  65. */
  66. declare function encodeURI(uri: string): string
  67. /**
  68. * Encodes a text string as a valid component of a Uniform Resource Identifier (URI).
  69. * @param uriComponent A value representing an encoded URI component.
  70. */
  71. declare function encodeURIComponent(
  72. uriComponent: string | number | boolean
  73. ): string
  74. /**
  75. * Computes a new string in which certain characters have been replaced by a hexadecimal escape sequence.
  76. * @param string A string value
  77. */
  78. declare function escape(string: string): string
  79. /**
  80. * Computes a new string in which hexadecimal escape sequences are replaced with the character that it represents.
  81. * @param string A string value
  82. */
  83. declare function unescape(string: string): string
  84. interface Symbol {
  85. /** Returns a string representation of an object. */
  86. toString(): string
  87. /** Returns the primitive value of the specified object. */
  88. valueOf(): symbol
  89. }
  90. declare type PropertyKey = string | number | symbol
  91. interface PropertyDescriptor {
  92. configurable?: boolean
  93. enumerable?: boolean
  94. value?: any
  95. writable?: boolean
  96. get?(): any
  97. set?(v: any): void
  98. }
  99. interface PropertyDescriptorMap {
  100. [s: string]: PropertyDescriptor
  101. }
  102. interface Object {
  103. /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */
  104. constructor: Function
  105. /** Returns a string representation of an object. */
  106. toString(): string
  107. /** Returns a date converted to a string using the current locale. */
  108. toLocaleString(): string
  109. /** Returns the primitive value of the specified object. */
  110. valueOf(): Object
  111. /**
  112. * Determines whether an object has a property with the specified name.
  113. * @param v A property name.
  114. */
  115. hasOwnProperty(v: PropertyKey): boolean
  116. /**
  117. * Determines whether an object exists in another object's prototype chain.
  118. * @param v Another object whose prototype chain is to be checked.
  119. */
  120. isPrototypeOf(v: Object): boolean
  121. /**
  122. * Determines whether a specified property is enumerable.
  123. * @param v A property name.
  124. */
  125. propertyIsEnumerable(v: PropertyKey): boolean
  126. }
  127. interface ObjectConstructor {
  128. new (value?: any): Object
  129. (): any
  130. (value: any): any
  131. /** A reference to the prototype for a class of objects. */
  132. readonly prototype: Object
  133. /**
  134. * Returns the prototype of an object.
  135. * @param o The object that references the prototype.
  136. */
  137. getPrototypeOf(o: any): any
  138. /**
  139. * Gets the own property descriptor of the specified object.
  140. * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype.
  141. * @param o Object that contains the property.
  142. * @param p Name of the property.
  143. */
  144. getOwnPropertyDescriptor(
  145. o: any,
  146. p: PropertyKey
  147. ): PropertyDescriptor | undefined
  148. /**
  149. * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly
  150. * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions.
  151. * @param o Object that contains the own properties.
  152. */
  153. getOwnPropertyNames(o: any): string[]
  154. /**
  155. * Creates an object that has the specified prototype or that has null prototype.
  156. * @param o Object to use as a prototype. May be null.
  157. */
  158. create(o: object | null): any
  159. /**
  160. * Creates an object that has the specified prototype, and that optionally contains specified properties.
  161. * @param o Object to use as a prototype. May be null
  162. * @param properties JavaScript object that contains one or more property descriptors.
  163. */
  164. create(
  165. o: object | null,
  166. properties: PropertyDescriptorMap & ThisType<any>
  167. ): any
  168. /**
  169. * Adds a property to an object, or modifies attributes of an existing property.
  170. * @param o Object on which to add or modify the property. This can be a native JavaScript object (that is, a user-defined object or a built in object) or a DOM object.
  171. * @param p The property name.
  172. * @param attributes Descriptor for the property. It can be for a data property or an accessor property.
  173. */
  174. defineProperty<T>(
  175. o: T,
  176. p: PropertyKey,
  177. attributes: PropertyDescriptor & ThisType<any>
  178. ): T
  179. /**
  180. * Adds one or more properties to an object, and/or modifies attributes of existing properties.
  181. * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object.
  182. * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property.
  183. */
  184. defineProperties<T>(
  185. o: T,
  186. properties: PropertyDescriptorMap & ThisType<any>
  187. ): T
  188. /**
  189. * Prevents the modification of attributes of existing properties, and prevents the addition of new properties.
  190. * @param o Object on which to lock the attributes.
  191. */
  192. seal<T>(o: T): T
  193. /**
  194. * Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
  195. * @param o Object on which to lock the attributes.
  196. */
  197. freeze<T>(a: T[]): readonly T[]
  198. /**
  199. * Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
  200. * @param o Object on which to lock the attributes.
  201. */
  202. freeze<T extends Function>(f: T): T
  203. /**
  204. * Prevents the modification of existing property attributes and values, and prevents the addition of new properties.
  205. * @param o Object on which to lock the attributes.
  206. */
  207. freeze<T>(o: T): Readonly<T>
  208. /**
  209. * Prevents the addition of new properties to an object.
  210. * @param o Object to make non-extensible.
  211. */
  212. preventExtensions<T>(o: T): T
  213. /**
  214. * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object.
  215. * @param o Object to test.
  216. */
  217. isSealed(o: any): boolean
  218. /**
  219. * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object.
  220. * @param o Object to test.
  221. */
  222. isFrozen(o: any): boolean
  223. /**
  224. * Returns a value that indicates whether new properties can be added to an object.
  225. * @param o Object to test.
  226. */
  227. isExtensible(o: any): boolean
  228. /**
  229. * Returns the names of the enumerable string properties and methods of an object.
  230. * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
  231. */
  232. keys(o: object): string[]
  233. }
  234. /**
  235. * Provides functionality common to all JavaScript objects.
  236. */
  237. declare var Object: ObjectConstructor
  238. /**
  239. * Creates a new function.
  240. */
  241. interface Function {
  242. /**
  243. * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function.
  244. * @param thisArg The object to be used as the this object.
  245. * @param argArray A set of arguments to be passed to the function.
  246. */
  247. apply(this: Function, thisArg: any, argArray?: any): any
  248. /**
  249. * Calls a method of an object, substituting another object for the current object.
  250. * @param thisArg The object to be used as the current object.
  251. * @param argArray A list of arguments to be passed to the method.
  252. */
  253. call(this: Function, thisArg: any, ...argArray: any[]): any
  254. /**
  255. * For a given function, creates a bound function that has the same body as the original function.
  256. * The this object of the bound function is associated with the specified object, and has the specified initial parameters.
  257. * @param thisArg An object to which the this keyword can refer inside the new function.
  258. * @param argArray A list of arguments to be passed to the new function.
  259. */
  260. bind(this: Function, thisArg: any, ...argArray: any[]): any
  261. /** Returns a string representation of a function. */
  262. toString(): string
  263. prototype: any
  264. readonly length: number
  265. // Non-standard extensions
  266. arguments: any
  267. caller: Function
  268. }
  269. interface FunctionConstructor {
  270. /**
  271. * Creates a new function.
  272. * @param args A list of arguments the function accepts.
  273. */
  274. new (...args: string[]): Function
  275. (...args: string[]): Function
  276. readonly prototype: Function
  277. }
  278. declare var Function: FunctionConstructor
  279. /**
  280. * Extracts the type of the 'this' parameter of a function type, or 'unknown' if the function type has no 'this' parameter.
  281. */
  282. type ThisParameterType<T> = T extends (this: infer U, ...args: any[]) => any
  283. ? U
  284. : unknown
  285. /**
  286. * Removes the 'this' parameter from a function type.
  287. */
  288. type OmitThisParameter<T> = unknown extends ThisParameterType<T>
  289. ? T
  290. : T extends (...args: infer A) => infer R
  291. ? (...args: A) => R
  292. : T
  293. interface CallableFunction extends Function {
  294. /**
  295. * Calls the function with the specified object as the this value and the elements of specified array as the arguments.
  296. * @param thisArg The object to be used as the this object.
  297. * @param args An array of argument values to be passed to the function.
  298. */
  299. apply<T, R>(this: (this: T) => R, thisArg: T): R
  300. apply<T, A extends any[], R>(
  301. this: (this: T, ...args: A) => R,
  302. thisArg: T,
  303. args: A
  304. ): R
  305. /**
  306. * Calls the function with the specified object as the this value and the specified rest arguments as the arguments.
  307. * @param thisArg The object to be used as the this object.
  308. * @param args Argument values to be passed to the function.
  309. */
  310. call<T, A extends any[], R>(
  311. this: (this: T, ...args: A) => R,
  312. thisArg: T,
  313. ...args: A
  314. ): R
  315. /**
  316. * For a given function, creates a bound function that has the same body as the original function.
  317. * The this object of the bound function is associated with the specified object, and has the specified initial parameters.
  318. * @param thisArg The object to be used as the this object.
  319. * @param args Arguments to bind to the parameters of the function.
  320. */
  321. bind<T>(this: T, thisArg: ThisParameterType<T>): OmitThisParameter<T>
  322. bind<T, A0, A extends any[], R>(
  323. this: (this: T, arg0: A0, ...args: A) => R,
  324. thisArg: T,
  325. arg0: A0
  326. ): (...args: A) => R
  327. bind<T, A0, A1, A extends any[], R>(
  328. this: (this: T, arg0: A0, arg1: A1, ...args: A) => R,
  329. thisArg: T,
  330. arg0: A0,
  331. arg1: A1
  332. ): (...args: A) => R
  333. bind<T, A0, A1, A2, A extends any[], R>(
  334. this: (this: T, arg0: A0, arg1: A1, arg2: A2, ...args: A) => R,
  335. thisArg: T,
  336. arg0: A0,
  337. arg1: A1,
  338. arg2: A2
  339. ): (...args: A) => R
  340. bind<T, A0, A1, A2, A3, A extends any[], R>(
  341. this: (this: T, arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R,
  342. thisArg: T,
  343. arg0: A0,
  344. arg1: A1,
  345. arg2: A2,
  346. arg3: A3
  347. ): (...args: A) => R
  348. bind<T, AX, R>(
  349. this: (this: T, ...args: AX[]) => R,
  350. thisArg: T,
  351. ...args: AX[]
  352. ): (...args: AX[]) => R
  353. }
  354. interface NewableFunction extends Function {
  355. /**
  356. * Calls the function with the specified object as the this value and the elements of specified array as the arguments.
  357. * @param thisArg The object to be used as the this object.
  358. * @param args An array of argument values to be passed to the function.
  359. */
  360. apply<T>(this: new () => T, thisArg: T): void
  361. apply<T, A extends any[]>(
  362. this: new (...args: A) => T,
  363. thisArg: T,
  364. args: A
  365. ): void
  366. /**
  367. * Calls the function with the specified object as the this value and the specified rest arguments as the arguments.
  368. * @param thisArg The object to be used as the this object.
  369. * @param args Argument values to be passed to the function.
  370. */
  371. call<T, A extends any[]>(
  372. this: new (...args: A) => T,
  373. thisArg: T,
  374. ...args: A
  375. ): void
  376. /**
  377. * For a given function, creates a bound function that has the same body as the original function.
  378. * The this object of the bound function is associated with the specified object, and has the specified initial parameters.
  379. * @param thisArg The object to be used as the this object.
  380. * @param args Arguments to bind to the parameters of the function.
  381. */
  382. bind<T>(this: T, thisArg: any): T
  383. bind<A0, A extends any[], R>(
  384. this: new (arg0: A0, ...args: A) => R,
  385. thisArg: any,
  386. arg0: A0
  387. ): new (...args: A) => R
  388. bind<A0, A1, A extends any[], R>(
  389. this: new (arg0: A0, arg1: A1, ...args: A) => R,
  390. thisArg: any,
  391. arg0: A0,
  392. arg1: A1
  393. ): new (...args: A) => R
  394. bind<A0, A1, A2, A extends any[], R>(
  395. this: new (arg0: A0, arg1: A1, arg2: A2, ...args: A) => R,
  396. thisArg: any,
  397. arg0: A0,
  398. arg1: A1,
  399. arg2: A2
  400. ): new (...args: A) => R
  401. bind<A0, A1, A2, A3, A extends any[], R>(
  402. this: new (arg0: A0, arg1: A1, arg2: A2, arg3: A3, ...args: A) => R,
  403. thisArg: any,
  404. arg0: A0,
  405. arg1: A1,
  406. arg2: A2,
  407. arg3: A3
  408. ): new (...args: A) => R
  409. bind<AX, R>(
  410. this: new (...args: AX[]) => R,
  411. thisArg: any,
  412. ...args: AX[]
  413. ): new (...args: AX[]) => R
  414. }
  415. interface IArguments {
  416. [index: number]: any
  417. length: number
  418. callee: Function
  419. }
  420. interface String {
  421. /** Returns a string representation of a string. */
  422. toString(): string
  423. /**
  424. * Returns the character at the specified index.
  425. * @param pos The zero-based index of the desired character.
  426. */
  427. charAt(pos: number): string
  428. /**
  429. * Returns the Unicode value of the character at the specified location.
  430. * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned.
  431. */
  432. charCodeAt(index: number): number
  433. /**
  434. * Returns a string that contains the concatenation of two or more strings.
  435. * @param strings The strings to append to the end of the string.
  436. */
  437. concat(...strings: string[]): string
  438. /**
  439. * Returns the position of the first occurrence of a substring.
  440. * @param searchString The substring to search for in the string
  441. * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string.
  442. */
  443. indexOf(searchString: string, position?: number): number
  444. /**
  445. * Returns the last occurrence of a substring in the string.
  446. * @param searchString The substring to search for.
  447. * @param position The index at which to begin searching. If omitted, the search begins at the end of the string.
  448. */
  449. lastIndexOf(searchString: string, position?: number): number
  450. /**
  451. * Determines whether two strings are equivalent in the current locale.
  452. * @param that String to compare to target string
  453. */
  454. localeCompare(that: string): number
  455. /**
  456. * Matches a string with a regular expression, and returns an array containing the results of that search.
  457. * @param regexp A variable name or string literal containing the regular expression pattern and flags.
  458. */
  459. match(regexp: string | RegExp): RegExpMatchArray | null
  460. /**
  461. * Replaces text in a string, using a regular expression or search string.
  462. * @param searchValue A string to search for.
  463. * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string.
  464. */
  465. replace(searchValue: string | RegExp, replaceValue: string): string
  466. /**
  467. * Replaces text in a string, using a regular expression or search string.
  468. * @param searchValue A string to search for.
  469. * @param replacer A function that returns the replacement text.
  470. */
  471. replace(
  472. searchValue: string | RegExp,
  473. replacer: (substring: string, ...args: any[]) => string
  474. ): string
  475. /**
  476. * Finds the first substring match in a regular expression search.
  477. * @param regexp The regular expression pattern and applicable flags.
  478. */
  479. search(regexp: string | RegExp): number
  480. /**
  481. * Returns a section of a string.
  482. * @param start The index to the beginning of the specified portion of stringObj.
  483. * @param end The index to the end of the specified portion of stringObj. The substring includes the characters up to, but not including, the character indicated by end.
  484. * If this value is not specified, the substring continues to the end of stringObj.
  485. */
  486. slice(start?: number, end?: number): string
  487. /**
  488. * Split a string into substrings using the specified separator and return them as an array.
  489. * @param separator A string that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned.
  490. * @param limit A value used to limit the number of elements returned in the array.
  491. */
  492. split(separator: string | RegExp, limit?: number): string[]
  493. /**
  494. * Returns the substring at the specified location within a String object.
  495. * @param start The zero-based index number indicating the beginning of the substring.
  496. * @param end Zero-based index number indicating the end of the substring. The substring includes the characters up to, but not including, the character indicated by end.
  497. * If end is omitted, the characters from start through the end of the original string are returned.
  498. */
  499. substring(start: number, end?: number): string
  500. /** Converts all the alphabetic characters in a string to lowercase. */
  501. toLowerCase(): string
  502. /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */
  503. toLocaleLowerCase(locales?: string | string[]): string
  504. /** Converts all the alphabetic characters in a string to uppercase. */
  505. toUpperCase(): string
  506. /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */
  507. toLocaleUpperCase(locales?: string | string[]): string
  508. /** Removes the leading and trailing white space and line terminator characters from a string. */
  509. trim(): string
  510. /** Returns the length of a String object. */
  511. readonly length: number
  512. // IE extensions
  513. /**
  514. * Gets a substring beginning at the specified location and having the specified length.
  515. * @param from The starting position of the desired substring. The index of the first character in the string is zero.
  516. * @param length The number of characters to include in the returned substring.
  517. */
  518. substr(from: number, length?: number): string
  519. /** Returns the primitive value of the specified object. */
  520. valueOf(): string
  521. readonly [index: number]: string
  522. }
  523. interface StringConstructor {
  524. new (value?: any): string
  525. (value?: any): string
  526. readonly prototype: string
  527. fromCharCode(...codes: number[]): string
  528. }
  529. /**
  530. * Allows manipulation and formatting of text strings and determination and location of substrings within strings.
  531. */
  532. declare var String: StringConstructor
  533. interface Boolean {
  534. /** Returns the primitive value of the specified object. */
  535. valueOf(): boolean
  536. }
  537. interface BooleanConstructor {
  538. new (value?: any): boolean
  539. <T>(value?: T): boolean
  540. readonly prototype: boolean
  541. }
  542. declare var Boolean: BooleanConstructor
  543. interface Number {
  544. /**
  545. * Returns a string representation of an object.
  546. * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers.
  547. */
  548. toString(radix?: number): string
  549. /**
  550. * Returns a string representing a number in fixed-point notation.
  551. * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive.
  552. */
  553. toFixed(fractionDigits?: number): string
  554. /**
  555. * Returns a string containing a number represented in exponential notation.
  556. * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive.
  557. */
  558. toExponential(fractionDigits?: number): string
  559. /**
  560. * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits.
  561. * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive.
  562. */
  563. toPrecision(precision?: number): string
  564. /** Returns the primitive value of the specified object. */
  565. valueOf(): number
  566. }
  567. interface NumberConstructor {
  568. new (value?: any): number
  569. (value?: any): number
  570. readonly prototype: number
  571. /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */
  572. readonly MAX_VALUE: number
  573. /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */
  574. readonly MIN_VALUE: number
  575. /**
  576. * A value that is not a number.
  577. * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function.
  578. */
  579. readonly NaN: number
  580. /**
  581. * A value that is less than the largest negative number that can be represented in JavaScript.
  582. * JavaScript displays NEGATIVE_INFINITY values as -infinity.
  583. */
  584. readonly NEGATIVE_INFINITY: number
  585. /**
  586. * A value greater than the largest number that can be represented in JavaScript.
  587. * JavaScript displays POSITIVE_INFINITY values as infinity.
  588. */
  589. readonly POSITIVE_INFINITY: number
  590. }
  591. /** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */
  592. declare var Number: NumberConstructor
  593. interface TemplateStringsArray extends ReadonlyArray<string> {
  594. readonly raw: readonly string[]
  595. }
  596. /**
  597. * The type of \`import.meta\`.
  598. *
  599. * If you need to declare that a given property exists on \`import.meta\`,
  600. * this type may be augmented via interface merging.
  601. */
  602. interface ImportMeta {}
  603. interface Math {
  604. /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */
  605. readonly E: number
  606. /** The natural logarithm of 10. */
  607. readonly LN10: number
  608. /** The natural logarithm of 2. */
  609. readonly LN2: number
  610. /** The base-2 logarithm of e. */
  611. readonly LOG2E: number
  612. /** The base-10 logarithm of e. */
  613. readonly LOG10E: number
  614. /** Pi. This is the ratio of the circumference of a circle to its diameter. */
  615. readonly PI: number
  616. /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */
  617. readonly SQRT1_2: number
  618. /** The square root of 2. */
  619. readonly SQRT2: number
  620. /**
  621. * Returns the absolute value of a number (the value without regard to whether it is positive or negative).
  622. * For example, the absolute value of -5 is the same as the absolute value of 5.
  623. * @param x A numeric expression for which the absolute value is needed.
  624. */
  625. abs(x: number): number
  626. /**
  627. * Returns the arc cosine (or inverse cosine) of a number.
  628. * @param x A numeric expression.
  629. */
  630. acos(x: number): number
  631. /**
  632. * Returns the arcsine of a number.
  633. * @param x A numeric expression.
  634. */
  635. asin(x: number): number
  636. /**
  637. * Returns the arctangent of a number.
  638. * @param x A numeric expression for which the arctangent is needed.
  639. */
  640. atan(x: number): number
  641. /**
  642. * Returns the angle (in radians) from the X axis to a point.
  643. * @param y A numeric expression representing the cartesian y-coordinate.
  644. * @param x A numeric expression representing the cartesian x-coordinate.
  645. */
  646. atan2(y: number, x: number): number
  647. /**
  648. * Returns the smallest integer greater than or equal to its numeric argument.
  649. * @param x A numeric expression.
  650. */
  651. ceil(x: number): number
  652. /**
  653. * Returns the cosine of a number.
  654. * @param x A numeric expression that contains an angle measured in radians.
  655. */
  656. cos(x: number): number
  657. /**
  658. * Returns e (the base of natural logarithms) raised to a power.
  659. * @param x A numeric expression representing the power of e.
  660. */
  661. exp(x: number): number
  662. /**
  663. * Returns the greatest integer less than or equal to its numeric argument.
  664. * @param x A numeric expression.
  665. */
  666. floor(x: number): number
  667. /**
  668. * Returns the natural logarithm (base e) of a number.
  669. * @param x A numeric expression.
  670. */
  671. log(x: number): number
  672. /**
  673. * Returns the larger of a set of supplied numeric expressions.
  674. * @param values Numeric expressions to be evaluated.
  675. */
  676. max(...values: number[]): number
  677. /**
  678. * Returns the smaller of a set of supplied numeric expressions.
  679. * @param values Numeric expressions to be evaluated.
  680. */
  681. min(...values: number[]): number
  682. /**
  683. * Returns the value of a base expression taken to a specified power.
  684. * @param x The base value of the expression.
  685. * @param y The exponent value of the expression.
  686. */
  687. pow(x: number, y: number): number
  688. /** Returns a pseudorandom number between 0 and 1. */
  689. random(): number
  690. /**
  691. * Returns a supplied numeric expression rounded to the nearest integer.
  692. * @param x The value to be rounded to the nearest integer.
  693. */
  694. round(x: number): number
  695. /**
  696. * Returns the sine of a number.
  697. * @param x A numeric expression that contains an angle measured in radians.
  698. */
  699. sin(x: number): number
  700. /**
  701. * Returns the square root of a number.
  702. * @param x A numeric expression.
  703. */
  704. sqrt(x: number): number
  705. /**
  706. * Returns the tangent of a number.
  707. * @param x A numeric expression that contains an angle measured in radians.
  708. */
  709. tan(x: number): number
  710. }
  711. /** An intrinsic object that provides basic mathematics functionality and constants. */
  712. declare var Math: Math
  713. /** Enables basic storage and retrieval of dates and times. */
  714. interface Date {
  715. /** Returns a string representation of a date. The format of the string depends on the locale. */
  716. toString(): string
  717. /** Returns a date as a string value. */
  718. toDateString(): string
  719. /** Returns a time as a string value. */
  720. toTimeString(): string
  721. /** Returns a value as a string value appropriate to the host environment's current locale. */
  722. toLocaleString(): string
  723. /** Returns a date as a string value appropriate to the host environment's current locale. */
  724. toLocaleDateString(): string
  725. /** Returns a time as a string value appropriate to the host environment's current locale. */
  726. toLocaleTimeString(): string
  727. /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */
  728. valueOf(): number
  729. /** Gets the time value in milliseconds. */
  730. getTime(): number
  731. /** Gets the year, using local time. */
  732. getFullYear(): number
  733. /** Gets the year using Universal Coordinated Time (UTC). */
  734. getUTCFullYear(): number
  735. /** Gets the month, using local time. */
  736. getMonth(): number
  737. /** Gets the month of a Date object using Universal Coordinated Time (UTC). */
  738. getUTCMonth(): number
  739. /** Gets the day-of-the-month, using local time. */
  740. getDate(): number
  741. /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */
  742. getUTCDate(): number
  743. /** Gets the day of the week, using local time. */
  744. getDay(): number
  745. /** Gets the day of the week using Universal Coordinated Time (UTC). */
  746. getUTCDay(): number
  747. /** Gets the hours in a date, using local time. */
  748. getHours(): number
  749. /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */
  750. getUTCHours(): number
  751. /** Gets the minutes of a Date object, using local time. */
  752. getMinutes(): number
  753. /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */
  754. getUTCMinutes(): number
  755. /** Gets the seconds of a Date object, using local time. */
  756. getSeconds(): number
  757. /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */
  758. getUTCSeconds(): number
  759. /** Gets the milliseconds of a Date, using local time. */
  760. getMilliseconds(): number
  761. /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */
  762. getUTCMilliseconds(): number
  763. /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */
  764. getTimezoneOffset(): number
  765. /**
  766. * Sets the date and time value in the Date object.
  767. * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT.
  768. */
  769. setTime(time: number): number
  770. /**
  771. * Sets the milliseconds value in the Date object using local time.
  772. * @param ms A numeric value equal to the millisecond value.
  773. */
  774. setMilliseconds(ms: number): number
  775. /**
  776. * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC).
  777. * @param ms A numeric value equal to the millisecond value.
  778. */
  779. setUTCMilliseconds(ms: number): number
  780. /**
  781. * Sets the seconds value in the Date object using local time.
  782. * @param sec A numeric value equal to the seconds value.
  783. * @param ms A numeric value equal to the milliseconds value.
  784. */
  785. setSeconds(sec: number, ms?: number): number
  786. /**
  787. * Sets the seconds value in the Date object using Universal Coordinated Time (UTC).
  788. * @param sec A numeric value equal to the seconds value.
  789. * @param ms A numeric value equal to the milliseconds value.
  790. */
  791. setUTCSeconds(sec: number, ms?: number): number
  792. /**
  793. * Sets the minutes value in the Date object using local time.
  794. * @param min A numeric value equal to the minutes value.
  795. * @param sec A numeric value equal to the seconds value.
  796. * @param ms A numeric value equal to the milliseconds value.
  797. */
  798. setMinutes(min: number, sec?: number, ms?: number): number
  799. /**
  800. * Sets the minutes value in the Date object using Universal Coordinated Time (UTC).
  801. * @param min A numeric value equal to the minutes value.
  802. * @param sec A numeric value equal to the seconds value.
  803. * @param ms A numeric value equal to the milliseconds value.
  804. */
  805. setUTCMinutes(min: number, sec?: number, ms?: number): number
  806. /**
  807. * Sets the hour value in the Date object using local time.
  808. * @param hours A numeric value equal to the hours value.
  809. * @param min A numeric value equal to the minutes value.
  810. * @param sec A numeric value equal to the seconds value.
  811. * @param ms A numeric value equal to the milliseconds value.
  812. */
  813. setHours(hours: number, min?: number, sec?: number, ms?: number): number
  814. /**
  815. * Sets the hours value in the Date object using Universal Coordinated Time (UTC).
  816. * @param hours A numeric value equal to the hours value.
  817. * @param min A numeric value equal to the minutes value.
  818. * @param sec A numeric value equal to the seconds value.
  819. * @param ms A numeric value equal to the milliseconds value.
  820. */
  821. setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number
  822. /**
  823. * Sets the numeric day-of-the-month value of the Date object using local time.
  824. * @param date A numeric value equal to the day of the month.
  825. */
  826. setDate(date: number): number
  827. /**
  828. * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC).
  829. * @param date A numeric value equal to the day of the month.
  830. */
  831. setUTCDate(date: number): number
  832. /**
  833. * Sets the month value in the Date object using local time.
  834. * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively.
  835. * @param date A numeric value representing the day of the month. If this value is not supplied, the value from a call to the getDate method is used.
  836. */
  837. setMonth(month: number, date?: number): number
  838. /**
  839. * Sets the month value in the Date object using Universal Coordinated Time (UTC).
  840. * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively.
  841. * @param date A numeric value representing the day of the month. If it is not supplied, the value from a call to the getUTCDate method is used.
  842. */
  843. setUTCMonth(month: number, date?: number): number
  844. /**
  845. * Sets the year of the Date object using local time.
  846. * @param year A numeric value for the year.
  847. * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified.
  848. * @param date A numeric value equal for the day of the month.
  849. */
  850. setFullYear(year: number, month?: number, date?: number): number
  851. /**
  852. * Sets the year value in the Date object using Universal Coordinated Time (UTC).
  853. * @param year A numeric value equal to the year.
  854. * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. Must be supplied if numDate is supplied.
  855. * @param date A numeric value equal to the day of the month.
  856. */
  857. setUTCFullYear(year: number, month?: number, date?: number): number
  858. /** Returns a date converted to a string using Universal Coordinated Time (UTC). */
  859. toUTCString(): string
  860. /** Returns a date as a string value in ISO format. */
  861. toISOString(): string
  862. /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */
  863. toJSON(key?: any): string
  864. }
  865. interface DateConstructor {
  866. new (): Date
  867. new (value: number | string): Date
  868. new (
  869. year: number,
  870. month: number,
  871. date?: number,
  872. hours?: number,
  873. minutes?: number,
  874. seconds?: number,
  875. ms?: number
  876. ): Date
  877. (): string
  878. readonly prototype: Date
  879. /**
  880. * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970.
  881. * @param s A date string
  882. */
  883. parse(s: string): number
  884. /**
  885. * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date.
  886. * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year.
  887. * @param month The month as a number between 0 and 11 (January to December).
  888. * @param date The date as a number between 1 and 31.
  889. * @param hours Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour.
  890. * @param minutes Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes.
  891. * @param seconds Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds.
  892. * @param ms A number from 0 to 999 that specifies the milliseconds.
  893. */
  894. UTC(
  895. year: number,
  896. month: number,
  897. date?: number,
  898. hours?: number,
  899. minutes?: number,
  900. seconds?: number,
  901. ms?: number
  902. ): number
  903. now(): number
  904. }
  905. declare var Date: DateConstructor
  906. interface RegExpMatchArray extends Array<string> {
  907. index?: number
  908. input?: string
  909. }
  910. interface RegExpExecArray extends Array<string> {
  911. index: number
  912. input: string
  913. }
  914. interface RegExp {
  915. /**
  916. * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search.
  917. * @param string The String object or string literal on which to perform the search.
  918. */
  919. exec(string: string): RegExpExecArray | null
  920. /**
  921. * Returns a Boolean value that indicates whether or not a pattern exists in a searched string.
  922. * @param string String on which to perform the search.
  923. */
  924. test(string: string): boolean
  925. /** Returns a copy of the text of the regular expression pattern. Read-only. The regExp argument is a Regular expression object. It can be a variable name or a literal. */
  926. readonly source: string
  927. /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */
  928. readonly global: boolean
  929. /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */
  930. readonly ignoreCase: boolean
  931. /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */
  932. readonly multiline: boolean
  933. lastIndex: number
  934. // Non-standard extensions
  935. compile(): this
  936. }
  937. interface RegExpConstructor {
  938. new (pattern: RegExp | string): RegExp
  939. new (pattern: string, flags?: string): RegExp
  940. (pattern: RegExp | string): RegExp
  941. (pattern: string, flags?: string): RegExp
  942. readonly prototype: RegExp
  943. // Non-standard extensions
  944. $1: string
  945. $2: string
  946. $3: string
  947. $4: string
  948. $5: string
  949. $6: string
  950. $7: string
  951. $8: string
  952. $9: string
  953. lastMatch: string
  954. }
  955. declare var RegExp: RegExpConstructor
  956. interface Error {
  957. name: string
  958. message: string
  959. stack?: string
  960. }
  961. interface ErrorConstructor {
  962. new (message?: string): Error
  963. (message?: string): Error
  964. readonly prototype: Error
  965. }
  966. declare var Error: ErrorConstructor
  967. type EvalError = Error
  968. interface EvalErrorConstructor extends ErrorConstructor {
  969. new (message?: string): EvalError
  970. (message?: string): EvalError
  971. readonly prototype: EvalError
  972. }
  973. declare var EvalError: EvalErrorConstructor
  974. type RangeError = Error
  975. interface RangeErrorConstructor extends ErrorConstructor {
  976. new (message?: string): RangeError
  977. (message?: string): RangeError
  978. readonly prototype: RangeError
  979. }
  980. declare var RangeError: RangeErrorConstructor
  981. type ReferenceError = Error
  982. interface ReferenceErrorConstructor extends ErrorConstructor {
  983. new (message?: string): ReferenceError
  984. (message?: string): ReferenceError
  985. readonly prototype: ReferenceError
  986. }
  987. declare var ReferenceError: ReferenceErrorConstructor
  988. type SyntaxError = Error
  989. interface SyntaxErrorConstructor extends ErrorConstructor {
  990. new (message?: string): SyntaxError
  991. (message?: string): SyntaxError
  992. readonly prototype: SyntaxError
  993. }
  994. declare var SyntaxError: SyntaxErrorConstructor
  995. type TypeError = Error
  996. interface TypeErrorConstructor extends ErrorConstructor {
  997. new (message?: string): TypeError
  998. (message?: string): TypeError
  999. readonly prototype: TypeError
  1000. }
  1001. declare var TypeError: TypeErrorConstructor
  1002. type URIError = Error
  1003. interface URIErrorConstructor extends ErrorConstructor {
  1004. new (message?: string): URIError
  1005. (message?: string): URIError
  1006. readonly prototype: URIError
  1007. }
  1008. declare var URIError: URIErrorConstructor
  1009. interface JSON {
  1010. /**
  1011. * Converts a JavaScript Object Notation (JSON) string into an object.
  1012. * @param text A valid JSON string.
  1013. * @param reviver A function that transforms the results. This function is called for each member of the object.
  1014. * If a member contains nested objects, the nested objects are transformed before the parent object is.
  1015. */
  1016. parse(
  1017. text: string,
  1018. reviver?: (this: any, key: string, value: any) => any
  1019. ): any
  1020. /**
  1021. * Converts a JavaScript value to a JavaScript Object Notation (JSON) string.
  1022. * @param value A JavaScript value, usually an object or array, to be converted.
  1023. * @param replacer A function that transforms the results.
  1024. * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
  1025. */
  1026. stringify(
  1027. value: any,
  1028. replacer?: (this: any, key: string, value: any) => any,
  1029. space?: string | number
  1030. ): string
  1031. /**
  1032. * Converts a JavaScript value to a JavaScript Object Notation (JSON) string.
  1033. * @param value A JavaScript value, usually an object or array, to be converted.
  1034. * @param replacer An array of strings and numbers that acts as an approved list for selecting the object properties that will be stringified.
  1035. * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read.
  1036. */
  1037. stringify(
  1038. value: any,
  1039. replacer?: (number | string)[] | null,
  1040. space?: string | number
  1041. ): string
  1042. }
  1043. /**
  1044. * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format.
  1045. */
  1046. declare var JSON: JSON
  1047. /////////////////////////////
  1048. /// ECMAScript Array API (specially handled by compiler)
  1049. /////////////////////////////
  1050. interface ReadonlyArray<T> {
  1051. /**
  1052. * Gets the length of the array. This is a number one higher than the highest element defined in an array.
  1053. */
  1054. readonly length: number
  1055. /**
  1056. * Returns a string representation of an array.
  1057. */
  1058. toString(): string
  1059. /**
  1060. * Returns a string representation of an array. The elements are converted to string using their toLocaleString methods.
  1061. */
  1062. toLocaleString(): string
  1063. /**
  1064. * Combines two or more arrays.
  1065. * @param items Additional items to add to the end of array1.
  1066. */
  1067. concat(...items: ConcatArray<T>[]): T[]
  1068. /**
  1069. * Combines two or more arrays.
  1070. * @param items Additional items to add to the end of array1.
  1071. */
  1072. concat(...items: (T | ConcatArray<T>)[]): T[]
  1073. /**
  1074. * Adds all the elements of an array separated by the specified separator string.
  1075. * @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.
  1076. */
  1077. join(separator?: string): string
  1078. /**
  1079. * Returns a section of an array.
  1080. * @param start The beginning of the specified portion of the array.
  1081. * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'.
  1082. */
  1083. slice(start?: number, end?: number): T[]
  1084. /**
  1085. * Returns the index of the first occurrence of a value in an array.
  1086. * @param searchElement The value to locate in the array.
  1087. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.
  1088. */
  1089. indexOf(searchElement: T, fromIndex?: number): number
  1090. /**
  1091. * Returns the index of the last occurrence of a specified value in an array.
  1092. * @param searchElement The value to locate in the array.
  1093. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array.
  1094. */
  1095. lastIndexOf(searchElement: T, fromIndex?: number): number
  1096. /**
  1097. * Determines whether all the members of an array satisfy the specified test.
  1098. * @param predicate A function that accepts up to three arguments. The every method calls
  1099. * the predicate function for each element in the array until the predicate returns a value
  1100. * which is coercible to the Boolean value false, or until the end of the array.
  1101. * @param thisArg An object to which the this keyword can refer in the predicate function.
  1102. * If thisArg is omitted, undefined is used as the this value.
  1103. */
  1104. every<S extends T>(
  1105. predicate: (value: T, index: number, array: readonly T[]) => value is S,
  1106. thisArg?: any
  1107. ): this is readonly S[]
  1108. /**
  1109. * Determines whether all the members of an array satisfy the specified test.
  1110. * @param predicate A function that accepts up to three arguments. The every method calls
  1111. * the predicate function for each element in the array until the predicate returns a value
  1112. * which is coercible to the Boolean value false, or until the end of the array.
  1113. * @param thisArg An object to which the this keyword can refer in the predicate function.
  1114. * If thisArg is omitted, undefined is used as the this value.
  1115. */
  1116. every(
  1117. predicate: (value: T, index: number, array: readonly T[]) => unknown,
  1118. thisArg?: any
  1119. ): boolean
  1120. /**
  1121. * Determines whether the specified callback function returns true for any element of an array.
  1122. * @param predicate A function that accepts up to three arguments. The some method calls
  1123. * the predicate function for each element in the array until the predicate returns a value
  1124. * which is coercible to the Boolean value true, or until the end of the array.
  1125. * @param thisArg An object to which the this keyword can refer in the predicate function.
  1126. * If thisArg is omitted, undefined is used as the this value.
  1127. */
  1128. some(
  1129. predicate: (value: T, index: number, array: readonly T[]) => unknown,
  1130. thisArg?: any
  1131. ): boolean
  1132. /**
  1133. * Performs the specified action for each element in an array.
  1134. * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.
  1135. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
  1136. */
  1137. forEach(
  1138. callbackfn: (value: T, index: number, array: readonly T[]) => void,
  1139. thisArg?: any
  1140. ): void
  1141. /**
  1142. * Calls a defined callback function on each element of an array, and returns an array that contains the results.
  1143. * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.
  1144. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
  1145. */
  1146. map<U>(
  1147. callbackfn: (value: T, index: number, array: readonly T[]) => U,
  1148. thisArg?: any
  1149. ): U[]
  1150. /**
  1151. * Returns the elements of an array that meet the condition specified in a callback function.
  1152. * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.
  1153. * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.
  1154. */
  1155. filter<S extends T>(
  1156. predicate: (value: T, index: number, array: readonly T[]) => value is S,
  1157. thisArg?: any
  1158. ): S[]
  1159. /**
  1160. * Returns the elements of an array that meet the condition specified in a callback function.
  1161. * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.
  1162. * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.
  1163. */
  1164. filter(
  1165. predicate: (value: T, index: number, array: readonly T[]) => unknown,
  1166. thisArg?: any
  1167. ): T[]
  1168. /**
  1169. * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
  1170. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
  1171. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
  1172. */
  1173. reduce(
  1174. callbackfn: (
  1175. previousValue: T,
  1176. currentValue: T,
  1177. currentIndex: number,
  1178. array: readonly T[]
  1179. ) => T
  1180. ): T
  1181. reduce(
  1182. callbackfn: (
  1183. previousValue: T,
  1184. currentValue: T,
  1185. currentIndex: number,
  1186. array: readonly T[]
  1187. ) => T,
  1188. initialValue: T
  1189. ): T
  1190. /**
  1191. * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
  1192. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
  1193. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
  1194. */
  1195. reduce<U>(
  1196. callbackfn: (
  1197. previousValue: U,
  1198. currentValue: T,
  1199. currentIndex: number,
  1200. array: readonly T[]
  1201. ) => U,
  1202. initialValue: U
  1203. ): U
  1204. /**
  1205. * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
  1206. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
  1207. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
  1208. */
  1209. reduceRight(
  1210. callbackfn: (
  1211. previousValue: T,
  1212. currentValue: T,
  1213. currentIndex: number,
  1214. array: readonly T[]
  1215. ) => T
  1216. ): T
  1217. reduceRight(
  1218. callbackfn: (
  1219. previousValue: T,
  1220. currentValue: T,
  1221. currentIndex: number,
  1222. array: readonly T[]
  1223. ) => T,
  1224. initialValue: T
  1225. ): T
  1226. /**
  1227. * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
  1228. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
  1229. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
  1230. */
  1231. reduceRight<U>(
  1232. callbackfn: (
  1233. previousValue: U,
  1234. currentValue: T,
  1235. currentIndex: number,
  1236. array: readonly T[]
  1237. ) => U,
  1238. initialValue: U
  1239. ): U
  1240. readonly [n: number]: T
  1241. }
  1242. interface ConcatArray<T> {
  1243. readonly length: number
  1244. readonly [n: number]: T
  1245. join(separator?: string): string
  1246. slice(start?: number, end?: number): T[]
  1247. }
  1248. interface Array<T> {
  1249. /**
  1250. * Gets or sets the length of the array. This is a number one higher than the highest index in the array.
  1251. */
  1252. length: number
  1253. /**
  1254. * Returns a string representation of an array.
  1255. */
  1256. toString(): string
  1257. /**
  1258. * Returns a string representation of an array. The elements are converted to string using their toLocaleString methods.
  1259. */
  1260. toLocaleString(): string
  1261. /**
  1262. * Removes the last element from an array and returns it.
  1263. * If the array is empty, undefined is returned and the array is not modified.
  1264. */
  1265. pop(): T | undefined
  1266. /**
  1267. * Appends new elements to the end of an array, and returns the new length of the array.
  1268. * @param items New elements to add to the array.
  1269. */
  1270. push(...items: T[]): number
  1271. /**
  1272. * Combines two or more arrays.
  1273. * This method returns a new array without modifying any existing arrays.
  1274. * @param items Additional arrays and/or items to add to the end of the array.
  1275. */
  1276. concat(...items: ConcatArray<T>[]): T[]
  1277. /**
  1278. * Combines two or more arrays.
  1279. * This method returns a new array without modifying any existing arrays.
  1280. * @param items Additional arrays and/or items to add to the end of the array.
  1281. */
  1282. concat(...items: (T | ConcatArray<T>)[]): T[]
  1283. /**
  1284. * Adds all the elements of an array into a string, separated by the specified separator string.
  1285. * @param separator A string used to separate one element of the array from the next in the resulting string. If omitted, the array elements are separated with a comma.
  1286. */
  1287. join(separator?: string): string
  1288. /**
  1289. * Reverses the elements in an array in place.
  1290. * This method mutates the array and returns a reference to the same array.
  1291. */
  1292. reverse(): T[]
  1293. /**
  1294. * Removes the first element from an array and returns it.
  1295. * If the array is empty, undefined is returned and the array is not modified.
  1296. */
  1297. shift(): T | undefined
  1298. /**
  1299. * Returns a copy of a section of an array.
  1300. * For both start and end, a negative index can be used to indicate an offset from the end of the array.
  1301. * For example, -2 refers to the second to last element of the array.
  1302. * @param start The beginning index of the specified portion of the array.
  1303. * If start is undefined, then the slice begins at index 0.
  1304. * @param end The end index of the specified portion of the array. This is exclusive of the element at the index 'end'.
  1305. * If end is undefined, then the slice extends to the end of the array.
  1306. */
  1307. slice(start?: number, end?: number): T[]
  1308. /**
  1309. * Sorts an array in place.
  1310. * This method mutates the array and returns a reference to the same array.
  1311. * @param compareFn Function used to determine the order of the elements. It is expected to return
  1312. * a negative value if first argument is less than second argument, zero if they're equal and a positive
  1313. * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
  1314. * \`\`\`ts
  1315. * [11,2,22,1].sort((a, b) => a - b)
  1316. * \`\`\`
  1317. */
  1318. sort(compareFn?: (a: T, b: T) => number): this
  1319. /**
  1320. * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
  1321. * @param start The zero-based location in the array from which to start removing elements.
  1322. * @param deleteCount The number of elements to remove.
  1323. * @returns An array containing the elements that were deleted.
  1324. */
  1325. splice(start: number, deleteCount?: number): T[]
  1326. /**
  1327. * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
  1328. * @param start The zero-based location in the array from which to start removing elements.
  1329. * @param deleteCount The number of elements to remove.
  1330. * @param items Elements to insert into the array in place of the deleted elements.
  1331. * @returns An array containing the elements that were deleted.
  1332. */
  1333. splice(start: number, deleteCount: number, ...items: T[]): T[]
  1334. /**
  1335. * Inserts new elements at the start of an array, and returns the new length of the array.
  1336. * @param items Elements to insert at the start of the array.
  1337. */
  1338. unshift(...items: T[]): number
  1339. /**
  1340. * Returns the index of the first occurrence of a value in an array, or -1 if it is not present.
  1341. * @param searchElement The value to locate in the array.
  1342. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.
  1343. */
  1344. indexOf(searchElement: T, fromIndex?: number): number
  1345. /**
  1346. * Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present.
  1347. * @param searchElement The value to locate in the array.
  1348. * @param fromIndex The array index at which to begin searching backward. If fromIndex is omitted, the search starts at the last index in the array.
  1349. */
  1350. lastIndexOf(searchElement: T, fromIndex?: number): number
  1351. /**
  1352. * Determines whether all the members of an array satisfy the specified test.
  1353. * @param predicate A function that accepts up to three arguments. The every method calls
  1354. * the predicate function for each element in the array until the predicate returns a value
  1355. * which is coercible to the Boolean value false, or until the end of the array.
  1356. * @param thisArg An object to which the this keyword can refer in the predicate function.
  1357. * If thisArg is omitted, undefined is used as the this value.
  1358. */
  1359. every<S extends T>(
  1360. predicate: (value: T, index: number, array: T[]) => value is S,
  1361. thisArg?: any
  1362. ): this is S[]
  1363. /**
  1364. * Determines whether all the members of an array satisfy the specified test.
  1365. * @param predicate A function that accepts up to three arguments. The every method calls
  1366. * the predicate function for each element in the array until the predicate returns a value
  1367. * which is coercible to the Boolean value false, or until the end of the array.
  1368. * @param thisArg An object to which the this keyword can refer in the predicate function.
  1369. * If thisArg is omitted, undefined is used as the this value.
  1370. */
  1371. every(
  1372. predicate: (value: T, index: number, array: T[]) => unknown,
  1373. thisArg?: any
  1374. ): boolean
  1375. /**
  1376. * Determines whether the specified callback function returns true for any element of an array.
  1377. * @param predicate A function that accepts up to three arguments. The some method calls
  1378. * the predicate function for each element in the array until the predicate returns a value
  1379. * which is coercible to the Boolean value true, or until the end of the array.
  1380. * @param thisArg An object to which the this keyword can refer in the predicate function.
  1381. * If thisArg is omitted, undefined is used as the this value.
  1382. */
  1383. some(
  1384. predicate: (value: T, index: number, array: T[]) => unknown,
  1385. thisArg?: any
  1386. ): boolean
  1387. /**
  1388. * Performs the specified action for each element in an array.
  1389. * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.
  1390. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
  1391. */
  1392. forEach(
  1393. callbackfn: (value: T, index: number, array: T[]) => void,
  1394. thisArg?: any
  1395. ): void
  1396. /**
  1397. * Calls a defined callback function on each element of an array, and returns an array that contains the results.
  1398. * @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.
  1399. * @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
  1400. */
  1401. map<U>(
  1402. callbackfn: (value: T, index: number, array: T[]) => U,
  1403. thisArg?: any
  1404. ): U[]
  1405. /**
  1406. * Returns the elements of an array that meet the condition specified in a callback function.
  1407. * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.
  1408. * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.
  1409. */
  1410. filter<S extends T>(
  1411. predicate: (value: T, index: number, array: T[]) => value is S,
  1412. thisArg?: any
  1413. ): S[]
  1414. /**
  1415. * Returns the elements of an array that meet the condition specified in a callback function.
  1416. * @param predicate A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.
  1417. * @param thisArg An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.
  1418. */
  1419. filter(
  1420. predicate: (value: T, index: number, array: T[]) => unknown,
  1421. thisArg?: any
  1422. ): T[]
  1423. /**
  1424. * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
  1425. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
  1426. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
  1427. */
  1428. reduce(
  1429. callbackfn: (
  1430. previousValue: T,
  1431. currentValue: T,
  1432. currentIndex: number,
  1433. array: T[]
  1434. ) => T
  1435. ): T
  1436. reduce(
  1437. callbackfn: (
  1438. previousValue: T,
  1439. currentValue: T,
  1440. currentIndex: number,
  1441. array: T[]
  1442. ) => T,
  1443. initialValue: T
  1444. ): T
  1445. /**
  1446. * Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
  1447. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
  1448. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
  1449. */
  1450. reduce<U>(
  1451. callbackfn: (
  1452. previousValue: U,
  1453. currentValue: T,
  1454. currentIndex: number,
  1455. array: T[]
  1456. ) => U,
  1457. initialValue: U
  1458. ): U
  1459. /**
  1460. * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
  1461. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
  1462. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
  1463. */
  1464. reduceRight(
  1465. callbackfn: (
  1466. previousValue: T,
  1467. currentValue: T,
  1468. currentIndex: number,
  1469. array: T[]
  1470. ) => T
  1471. ): T
  1472. reduceRight(
  1473. callbackfn: (
  1474. previousValue: T,
  1475. currentValue: T,
  1476. currentIndex: number,
  1477. array: T[]
  1478. ) => T,
  1479. initialValue: T
  1480. ): T
  1481. /**
  1482. * Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
  1483. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
  1484. * @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
  1485. */
  1486. reduceRight<U>(
  1487. callbackfn: (
  1488. previousValue: U,
  1489. currentValue: T,
  1490. currentIndex: number,
  1491. array: T[]
  1492. ) => U,
  1493. initialValue: U
  1494. ): U
  1495. [n: number]: T
  1496. }
  1497. interface ArrayConstructor {
  1498. new (arrayLength?: number): any[]
  1499. new <T>(arrayLength: number): T[]
  1500. new <T>(...items: T[]): T[]
  1501. (arrayLength?: number): any[]
  1502. <T>(arrayLength: number): T[]
  1503. <T>(...items: T[]): T[]
  1504. isArray(arg: any): arg is any[]
  1505. readonly prototype: any[]
  1506. }
  1507. declare var Array: ArrayConstructor
  1508. interface TypedPropertyDescriptor<T> {
  1509. enumerable?: boolean
  1510. configurable?: boolean
  1511. writable?: boolean
  1512. value?: T
  1513. get?: () => T
  1514. set?: (value: T) => void
  1515. }
  1516. declare type ClassDecorator = <TFunction extends Function>(
  1517. target: TFunction
  1518. ) => TFunction | void
  1519. declare type PropertyDecorator = (
  1520. target: Object,
  1521. propertyKey: string | symbol
  1522. ) => void
  1523. declare type MethodDecorator = <T>(
  1524. target: Object,
  1525. propertyKey: string | symbol,
  1526. descriptor: TypedPropertyDescriptor<T>
  1527. ) => TypedPropertyDescriptor<T> | void
  1528. declare type ParameterDecorator = (
  1529. target: Object,
  1530. propertyKey: string | symbol,
  1531. parameterIndex: number
  1532. ) => void
  1533. declare type PromiseConstructorLike = new <T>(
  1534. executor: (
  1535. resolve: (value: T | PromiseLike<T>) => void,
  1536. reject: (reason?: any) => void
  1537. ) => void
  1538. ) => PromiseLike<T>
  1539. interface PromiseLike<T> {
  1540. /**
  1541. * Attaches callbacks for the resolution and/or rejection of the Promise.
  1542. * @param onfulfilled The callback to execute when the Promise is resolved.
  1543. * @param onrejected The callback to execute when the Promise is rejected.
  1544. * @returns A Promise for the completion of which ever callback is executed.
  1545. */
  1546. then<TResult1 = T, TResult2 = never>(
  1547. onfulfilled?:
  1548. | ((value: T) => TResult1 | PromiseLike<TResult1>)
  1549. | undefined
  1550. | null,
  1551. onrejected?:
  1552. | ((reason: any) => TResult2 | PromiseLike<TResult2>)
  1553. | undefined
  1554. | null
  1555. ): PromiseLike<TResult1 | TResult2>
  1556. }
  1557. /**
  1558. * Represents the completion of an asynchronous operation
  1559. */
  1560. interface Promise<T> {
  1561. /**
  1562. * Attaches callbacks for the resolution and/or rejection of the Promise.
  1563. * @param onfulfilled The callback to execute when the Promise is resolved.
  1564. * @param onrejected The callback to execute when the Promise is rejected.
  1565. * @returns A Promise for the completion of which ever callback is executed.
  1566. */
  1567. then<TResult1 = T, TResult2 = never>(
  1568. onfulfilled?:
  1569. | ((value: T) => TResult1 | PromiseLike<TResult1>)
  1570. | undefined
  1571. | null,
  1572. onrejected?:
  1573. | ((reason: any) => TResult2 | PromiseLike<TResult2>)
  1574. | undefined
  1575. | null
  1576. ): Promise<TResult1 | TResult2>
  1577. /**
  1578. * Attaches a callback for only the rejection of the Promise.
  1579. * @param onrejected The callback to execute when the Promise is rejected.
  1580. * @returns A Promise for the completion of the callback.
  1581. */
  1582. catch<TResult = never>(
  1583. onrejected?:
  1584. | ((reason: any) => TResult | PromiseLike<TResult>)
  1585. | undefined
  1586. | null
  1587. ): Promise<T | TResult>
  1588. }
  1589. interface ArrayLike<T> {
  1590. readonly length: number
  1591. readonly [n: number]: T
  1592. }
  1593. /**
  1594. * Make all properties in T optional
  1595. */
  1596. type Partial<T> = {
  1597. [P in keyof T]?: T[P]
  1598. }
  1599. /**
  1600. * Make all properties in T required
  1601. */
  1602. type Required<T> = {
  1603. [P in keyof T]-?: T[P]
  1604. }
  1605. /**
  1606. * Make all properties in T readonly
  1607. */
  1608. type Readonly<T> = {
  1609. readonly [P in keyof T]: T[P]
  1610. }
  1611. /**
  1612. * From T, pick a set of properties whose keys are in the union K
  1613. */
  1614. type Pick<T, K extends keyof T> = {
  1615. [P in K]: T[P]
  1616. }
  1617. /**
  1618. * Construct a type with a set of properties K of type T
  1619. */
  1620. type Record<K extends keyof any, T> = {
  1621. [P in K]: T
  1622. }
  1623. /**
  1624. * Exclude from T those types that are assignable to U
  1625. */
  1626. type Exclude<T, U> = T extends U ? never : T
  1627. /**
  1628. * Extract from T those types that are assignable to U
  1629. */
  1630. type Extract<T, U> = T extends U ? T : never
  1631. /**
  1632. * Construct a type with the properties of T except for those in type K.
  1633. */
  1634. type Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>
  1635. /**
  1636. * Exclude null and undefined from T
  1637. */
  1638. type NonNullable<T> = T extends null | undefined ? never : T
  1639. /**
  1640. * Obtain the parameters of a function type in a tuple
  1641. */
  1642. type Parameters<T extends (...args: any) => any> = T extends (
  1643. ...args: infer P
  1644. ) => any
  1645. ? P
  1646. : never
  1647. /**
  1648. * Obtain the parameters of a constructor function type in a tuple
  1649. */
  1650. type ConstructorParameters<T extends abstract new (...args: any) => any> =
  1651. T extends abstract new (...args: infer P) => any ? P : never
  1652. /**
  1653. * Obtain the return type of a function type
  1654. */
  1655. type ReturnType<T extends (...args: any) => any> = T extends (
  1656. ...args: any
  1657. ) => infer R
  1658. ? R
  1659. : any
  1660. /**
  1661. * Obtain the return type of a constructor function type
  1662. */
  1663. type InstanceType<T extends abstract new (...args: any) => any> =
  1664. T extends abstract new (...args: any) => infer R ? R : any
  1665. /**
  1666. * Convert string literal type to uppercase
  1667. */
  1668. type Uppercase<S extends string> = intrinsic
  1669. /**
  1670. * Convert string literal type to lowercase
  1671. */
  1672. type Lowercase<S extends string> = intrinsic
  1673. /**
  1674. * Convert first character of string literal type to uppercase
  1675. */
  1676. type Capitalize<S extends string> = intrinsic
  1677. /**
  1678. * Convert first character of string literal type to lowercase
  1679. */
  1680. type Uncapitalize<S extends string> = intrinsic
  1681. /**
  1682. * Marker for contextual 'this' type
  1683. */
  1684. interface ThisType<T> {}
  1685. /**
  1686. * Represents a raw buffer of binary data, which is used to store data for the
  1687. * different typed arrays. ArrayBuffers cannot be read from or written to directly,
  1688. * but can be passed to a typed array or DataView Object to interpret the raw
  1689. * buffer as needed.
  1690. */
  1691. interface ArrayBuffer {
  1692. /**
  1693. * Read-only. The length of the ArrayBuffer (in bytes).
  1694. */
  1695. readonly byteLength: number
  1696. /**
  1697. * Returns a section of an ArrayBuffer.
  1698. */
  1699. slice(begin: number, end?: number): ArrayBuffer
  1700. }
  1701. /**
  1702. * Allowed ArrayBuffer types for the buffer of an ArrayBufferView and related Typed Arrays.
  1703. */
  1704. interface ArrayBufferTypes {
  1705. ArrayBuffer: ArrayBuffer
  1706. }
  1707. type ArrayBufferLike = ArrayBufferTypes[keyof ArrayBufferTypes]
  1708. interface ArrayBufferConstructor {
  1709. readonly prototype: ArrayBuffer
  1710. new (byteLength: number): ArrayBuffer
  1711. isView(arg: any): arg is ArrayBufferView
  1712. }
  1713. declare var ArrayBuffer: ArrayBufferConstructor
  1714. interface ArrayBufferView {
  1715. /**
  1716. * The ArrayBuffer instance referenced by the array.
  1717. */
  1718. buffer: ArrayBufferLike
  1719. /**
  1720. * The length in bytes of the array.
  1721. */
  1722. byteLength: number
  1723. /**
  1724. * The offset in bytes of the array.
  1725. */
  1726. byteOffset: number
  1727. }
  1728. interface DataView {
  1729. readonly buffer: ArrayBuffer
  1730. readonly byteLength: number
  1731. readonly byteOffset: number
  1732. /**
  1733. * Gets the Float32 value at the specified byte offset from the start of the view. There is
  1734. * no alignment constraint; multi-byte values may be fetched from any offset.
  1735. * @param byteOffset The place in the buffer at which the value should be retrieved.
  1736. */
  1737. getFloat32(byteOffset: number, littleEndian?: boolean): number
  1738. /**
  1739. * Gets the Float64 value at the specified byte offset from the start of the view. There is
  1740. * no alignment constraint; multi-byte values may be fetched from any offset.
  1741. * @param byteOffset The place in the buffer at which the value should be retrieved.
  1742. */
  1743. getFloat64(byteOffset: number, littleEndian?: boolean): number
  1744. /**
  1745. * Gets the Int8 value at the specified byte offset from the start of the view. There is
  1746. * no alignment constraint; multi-byte values may be fetched from any offset.
  1747. * @param byteOffset The place in the buffer at which the value should be retrieved.
  1748. */
  1749. getInt8(byteOffset: number): number
  1750. /**
  1751. * Gets the Int16 value at the specified byte offset from the start of the view. There is
  1752. * no alignment constraint; multi-byte values may be fetched from any offset.
  1753. * @param byteOffset The place in the buffer at which the value should be retrieved.
  1754. */
  1755. getInt16(byteOffset: number, littleEndian?: boolean): number
  1756. /**
  1757. * Gets the Int32 value at the specified byte offset from the start of the view. There is
  1758. * no alignment constraint; multi-byte values may be fetched from any offset.
  1759. * @param byteOffset The place in the buffer at which the value should be retrieved.
  1760. */
  1761. getInt32(byteOffset: number, littleEndian?: boolean): number
  1762. /**
  1763. * Gets the Uint8 value at the specified byte offset from the start of the view. There is
  1764. * no alignment constraint; multi-byte values may be fetched from any offset.
  1765. * @param byteOffset The place in the buffer at which the value should be retrieved.
  1766. */
  1767. getUint8(byteOffset: number): number
  1768. /**
  1769. * Gets the Uint16 value at the specified byte offset from the start of the view. There is
  1770. * no alignment constraint; multi-byte values may be fetched from any offset.
  1771. * @param byteOffset The place in the buffer at which the value should be retrieved.
  1772. */
  1773. getUint16(byteOffset: number, littleEndian?: boolean): number
  1774. /**
  1775. * Gets the Uint32 value at the specified byte offset from the start of the view. There is
  1776. * no alignment constraint; multi-byte values may be fetched from any offset.
  1777. * @param byteOffset The place in the buffer at which the value should be retrieved.
  1778. */
  1779. getUint32(byteOffset: number, littleEndian?: boolean): number
  1780. /**
  1781. * Stores an Float32 value at the specified byte offset from the start of the view.
  1782. * @param byteOffset The place in the buffer at which the value should be set.
  1783. * @param value The value to set.
  1784. * @param littleEndian If false or undefined, a big-endian value should be written,
  1785. * otherwise a little-endian value should be written.
  1786. */
  1787. setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void
  1788. /**
  1789. * Stores an Float64 value at the specified byte offset from the start of the view.
  1790. * @param byteOffset The place in the buffer at which the value should be set.
  1791. * @param value The value to set.
  1792. * @param littleEndian If false or undefined, a big-endian value should be written,
  1793. * otherwise a little-endian value should be written.
  1794. */
  1795. setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void
  1796. /**
  1797. * Stores an Int8 value at the specified byte offset from the start of the view.
  1798. * @param byteOffset The place in the buffer at which the value should be set.
  1799. * @param value The value to set.
  1800. */
  1801. setInt8(byteOffset: number, value: number): void
  1802. /**
  1803. * Stores an Int16 value at the specified byte offset from the start of the view.
  1804. * @param byteOffset The place in the buffer at which the value should be set.
  1805. * @param value The value to set.
  1806. * @param littleEndian If false or undefined, a big-endian value should be written,
  1807. * otherwise a little-endian value should be written.
  1808. */
  1809. setInt16(byteOffset: number, value: number, littleEndian?: boolean): void
  1810. /**
  1811. * Stores an Int32 value at the specified byte offset from the start of the view.
  1812. * @param byteOffset The place in the buffer at which the value should be set.
  1813. * @param value The value to set.
  1814. * @param littleEndian If false or undefined, a big-endian value should be written,
  1815. * otherwise a little-endian value should be written.
  1816. */
  1817. setInt32(byteOffset: number, value: number, littleEndian?: boolean): void
  1818. /**
  1819. * Stores an Uint8 value at the specified byte offset from the start of the view.
  1820. * @param byteOffset The place in the buffer at which the value should be set.
  1821. * @param value The value to set.
  1822. */
  1823. setUint8(byteOffset: number, value: number): void
  1824. /**
  1825. * Stores an Uint16 value at the specified byte offset from the start of the view.
  1826. * @param byteOffset The place in the buffer at which the value should be set.
  1827. * @param value The value to set.
  1828. * @param littleEndian If false or undefined, a big-endian value should be written,
  1829. * otherwise a little-endian value should be written.
  1830. */
  1831. setUint16(byteOffset: number, value: number, littleEndian?: boolean): void
  1832. /**
  1833. * Stores an Uint32 value at the specified byte offset from the start of the view.
  1834. * @param byteOffset The place in the buffer at which the value should be set.
  1835. * @param value The value to set.
  1836. * @param littleEndian If false or undefined, a big-endian value should be written,
  1837. * otherwise a little-endian value should be written.
  1838. */
  1839. setUint32(byteOffset: number, value: number, littleEndian?: boolean): void
  1840. }
  1841. interface DataViewConstructor {
  1842. readonly prototype: DataView
  1843. new (
  1844. buffer: ArrayBufferLike,
  1845. byteOffset?: number,
  1846. byteLength?: number
  1847. ): DataView
  1848. }
  1849. declare var DataView: DataViewConstructor
  1850. /**
  1851. * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested
  1852. * number of bytes could not be allocated an exception is raised.
  1853. */
  1854. interface Int8Array {
  1855. /**
  1856. * The size in bytes of each element in the array.
  1857. */
  1858. readonly BYTES_PER_ELEMENT: number
  1859. /**
  1860. * The ArrayBuffer instance referenced by the array.
  1861. */
  1862. readonly buffer: ArrayBufferLike
  1863. /**
  1864. * The length in bytes of the array.
  1865. */
  1866. readonly byteLength: number
  1867. /**
  1868. * The offset in bytes of the array.
  1869. */
  1870. readonly byteOffset: number
  1871. /**
  1872. * Returns the this object after copying a section of the array identified by start and end
  1873. * to the same array starting at position target
  1874. * @param target If target is negative, it is treated as length+target where length is the
  1875. * length of the array.
  1876. * @param start If start is negative, it is treated as length+start. If end is negative, it
  1877. * is treated as length+end.
  1878. * @param end If not specified, length of the this object is used as its default value.
  1879. */
  1880. copyWithin(target: number, start: number, end?: number): this
  1881. /**
  1882. * Determines whether all the members of an array satisfy the specified test.
  1883. * @param predicate A function that accepts up to three arguments. The every method calls
  1884. * the predicate function for each element in the array until the predicate returns a value
  1885. * which is coercible to the Boolean value false, or until the end of the array.
  1886. * @param thisArg An object to which the this keyword can refer in the predicate function.
  1887. * If thisArg is omitted, undefined is used as the this value.
  1888. */
  1889. every(
  1890. predicate: (value: number, index: number, array: Int8Array) => unknown,
  1891. thisArg?: any
  1892. ): boolean
  1893. /**
  1894. * Changes all array elements from \`start\` to \`end\` index to a static \`value\` and returns the modified array
  1895. * @param value value to fill array section with
  1896. * @param start index to start filling the array at. If start is negative, it is treated as
  1897. * length+start where length is the length of the array.
  1898. * @param end index to stop filling the array at. If end is negative, it is treated as
  1899. * length+end.
  1900. */
  1901. fill(value: number, start?: number, end?: number): this
  1902. /**
  1903. * Returns the elements of an array that meet the condition specified in a callback function.
  1904. * @param predicate A function that accepts up to three arguments. The filter method calls
  1905. * the predicate function one time for each element in the array.
  1906. * @param thisArg An object to which the this keyword can refer in the predicate function.
  1907. * If thisArg is omitted, undefined is used as the this value.
  1908. */
  1909. filter(
  1910. predicate: (value: number, index: number, array: Int8Array) => any,
  1911. thisArg?: any
  1912. ): Int8Array
  1913. /**
  1914. * Returns the value of the first element in the array where predicate is true, and undefined
  1915. * otherwise.
  1916. * @param predicate find calls predicate once for each element of the array, in ascending
  1917. * order, until it finds one where predicate returns true. If such an element is found, find
  1918. * immediately returns that element value. Otherwise, find returns undefined.
  1919. * @param thisArg If provided, it will be used as the this value for each invocation of
  1920. * predicate. If it is not provided, undefined is used instead.
  1921. */
  1922. find(
  1923. predicate: (value: number, index: number, obj: Int8Array) => boolean,
  1924. thisArg?: any
  1925. ): number | undefined
  1926. /**
  1927. * Returns the index of the first element in the array where predicate is true, and -1
  1928. * otherwise.
  1929. * @param predicate find calls predicate once for each element of the array, in ascending
  1930. * order, until it finds one where predicate returns true. If such an element is found,
  1931. * findIndex immediately returns that element index. Otherwise, findIndex returns -1.
  1932. * @param thisArg If provided, it will be used as the this value for each invocation of
  1933. * predicate. If it is not provided, undefined is used instead.
  1934. */
  1935. findIndex(
  1936. predicate: (value: number, index: number, obj: Int8Array) => boolean,
  1937. thisArg?: any
  1938. ): number
  1939. /**
  1940. * Performs the specified action for each element in an array.
  1941. * @param callbackfn A function that accepts up to three arguments. forEach calls the
  1942. * callbackfn function one time for each element in the array.
  1943. * @param thisArg An object to which the this keyword can refer in the callbackfn function.
  1944. * If thisArg is omitted, undefined is used as the this value.
  1945. */
  1946. forEach(
  1947. callbackfn: (value: number, index: number, array: Int8Array) => void,
  1948. thisArg?: any
  1949. ): void
  1950. /**
  1951. * Returns the index of the first occurrence of a value in an array.
  1952. * @param searchElement The value to locate in the array.
  1953. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
  1954. * search starts at index 0.
  1955. */
  1956. indexOf(searchElement: number, fromIndex?: number): number
  1957. /**
  1958. * Adds all the elements of an array separated by the specified separator string.
  1959. * @param separator A string used to separate one element of an array from the next in the
  1960. * resulting String. If omitted, the array elements are separated with a comma.
  1961. */
  1962. join(separator?: string): string
  1963. /**
  1964. * Returns the index of the last occurrence of a value in an array.
  1965. * @param searchElement The value to locate in the array.
  1966. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
  1967. * search starts at index 0.
  1968. */
  1969. lastIndexOf(searchElement: number, fromIndex?: number): number
  1970. /**
  1971. * The length of the array.
  1972. */
  1973. readonly length: number
  1974. /**
  1975. * Calls a defined callback function on each element of an array, and returns an array that
  1976. * contains the results.
  1977. * @param callbackfn A function that accepts up to three arguments. The map method calls the
  1978. * callbackfn function one time for each element in the array.
  1979. * @param thisArg An object to which the this keyword can refer in the callbackfn function.
  1980. * If thisArg is omitted, undefined is used as the this value.
  1981. */
  1982. map(
  1983. callbackfn: (value: number, index: number, array: Int8Array) => number,
  1984. thisArg?: any
  1985. ): Int8Array
  1986. /**
  1987. * Calls the specified callback function for all the elements in an array. The return value of
  1988. * the callback function is the accumulated result, and is provided as an argument in the next
  1989. * call to the callback function.
  1990. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the
  1991. * callbackfn function one time for each element in the array.
  1992. * @param initialValue If initialValue is specified, it is used as the initial value to start
  1993. * the accumulation. The first call to the callbackfn function provides this value as an argument
  1994. * instead of an array value.
  1995. */
  1996. reduce(
  1997. callbackfn: (
  1998. previousValue: number,
  1999. currentValue: number,
  2000. currentIndex: number,
  2001. array: Int8Array
  2002. ) => number
  2003. ): number
  2004. reduce(
  2005. callbackfn: (
  2006. previousValue: number,
  2007. currentValue: number,
  2008. currentIndex: number,
  2009. array: Int8Array
  2010. ) => number,
  2011. initialValue: number
  2012. ): number
  2013. /**
  2014. * Calls the specified callback function for all the elements in an array. The return value of
  2015. * the callback function is the accumulated result, and is provided as an argument in the next
  2016. * call to the callback function.
  2017. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the
  2018. * callbackfn function one time for each element in the array.
  2019. * @param initialValue If initialValue is specified, it is used as the initial value to start
  2020. * the accumulation. The first call to the callbackfn function provides this value as an argument
  2021. * instead of an array value.
  2022. */
  2023. reduce<U>(
  2024. callbackfn: (
  2025. previousValue: U,
  2026. currentValue: number,
  2027. currentIndex: number,
  2028. array: Int8Array
  2029. ) => U,
  2030. initialValue: U
  2031. ): U
  2032. /**
  2033. * Calls the specified callback function for all the elements in an array, in descending order.
  2034. * The return value of the callback function is the accumulated result, and is provided as an
  2035. * argument in the next call to the callback function.
  2036. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
  2037. * the callbackfn function one time for each element in the array.
  2038. * @param initialValue If initialValue is specified, it is used as the initial value to start
  2039. * the accumulation. The first call to the callbackfn function provides this value as an
  2040. * argument instead of an array value.
  2041. */
  2042. reduceRight(
  2043. callbackfn: (
  2044. previousValue: number,
  2045. currentValue: number,
  2046. currentIndex: number,
  2047. array: Int8Array
  2048. ) => number
  2049. ): number
  2050. reduceRight(
  2051. callbackfn: (
  2052. previousValue: number,
  2053. currentValue: number,
  2054. currentIndex: number,
  2055. array: Int8Array
  2056. ) => number,
  2057. initialValue: number
  2058. ): number
  2059. /**
  2060. * Calls the specified callback function for all the elements in an array, in descending order.
  2061. * The return value of the callback function is the accumulated result, and is provided as an
  2062. * argument in the next call to the callback function.
  2063. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
  2064. * the callbackfn function one time for each element in the array.
  2065. * @param initialValue If initialValue is specified, it is used as the initial value to start
  2066. * the accumulation. The first call to the callbackfn function provides this value as an argument
  2067. * instead of an array value.
  2068. */
  2069. reduceRight<U>(
  2070. callbackfn: (
  2071. previousValue: U,
  2072. currentValue: number,
  2073. currentIndex: number,
  2074. array: Int8Array
  2075. ) => U,
  2076. initialValue: U
  2077. ): U
  2078. /**
  2079. * Reverses the elements in an Array.
  2080. */
  2081. reverse(): Int8Array
  2082. /**
  2083. * Sets a value or an array of values.
  2084. * @param array A typed or untyped array of values to set.
  2085. * @param offset The index in the current array at which the values are to be written.
  2086. */
  2087. set(array: ArrayLike<number>, offset?: number): void
  2088. /**
  2089. * Returns a section of an array.
  2090. * @param start The beginning of the specified portion of the array.
  2091. * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'.
  2092. */
  2093. slice(start?: number, end?: number): Int8Array
  2094. /**
  2095. * Determines whether the specified callback function returns true for any element of an array.
  2096. * @param predicate A function that accepts up to three arguments. The some method calls
  2097. * the predicate function for each element in the array until the predicate returns a value
  2098. * which is coercible to the Boolean value true, or until the end of the array.
  2099. * @param thisArg An object to which the this keyword can refer in the predicate function.
  2100. * If thisArg is omitted, undefined is used as the this value.
  2101. */
  2102. some(
  2103. predicate: (value: number, index: number, array: Int8Array) => unknown,
  2104. thisArg?: any
  2105. ): boolean
  2106. /**
  2107. * Sorts an array.
  2108. * @param compareFn Function used to determine the order of the elements. It is expected to return
  2109. * a negative value if first argument is less than second argument, zero if they're equal and a positive
  2110. * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
  2111. * \`\`\`ts
  2112. * [11,2,22,1].sort((a, b) => a - b)
  2113. * \`\`\`
  2114. */
  2115. sort(compareFn?: (a: number, b: number) => number): this
  2116. /**
  2117. * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements
  2118. * at begin, inclusive, up to end, exclusive.
  2119. * @param begin The index of the beginning of the array.
  2120. * @param end The index of the end of the array.
  2121. */
  2122. subarray(begin?: number, end?: number): Int8Array
  2123. /**
  2124. * Converts a number to a string by using the current locale.
  2125. */
  2126. toLocaleString(): string
  2127. /**
  2128. * Returns a string representation of an array.
  2129. */
  2130. toString(): string
  2131. /** Returns the primitive value of the specified object. */
  2132. valueOf(): Int8Array
  2133. [index: number]: number
  2134. }
  2135. interface Int8ArrayConstructor {
  2136. readonly prototype: Int8Array
  2137. new (length: number): Int8Array
  2138. new (array: ArrayLike<number> | ArrayBufferLike): Int8Array
  2139. new (buffer: ArrayBufferLike, byteOffset?: number, length?: number): Int8Array
  2140. /**
  2141. * The size in bytes of each element in the array.
  2142. */
  2143. readonly BYTES_PER_ELEMENT: number
  2144. /**
  2145. * Returns a new array from a set of elements.
  2146. * @param items A set of elements to include in the new array object.
  2147. */
  2148. of(...items: number[]): Int8Array
  2149. /**
  2150. * Creates an array from an array-like or iterable object.
  2151. * @param arrayLike An array-like or iterable object to convert to an array.
  2152. */
  2153. from(arrayLike: ArrayLike<number>): Int8Array
  2154. /**
  2155. * Creates an array from an array-like or iterable object.
  2156. * @param arrayLike An array-like or iterable object to convert to an array.
  2157. * @param mapfn A mapping function to call on every element of the array.
  2158. * @param thisArg Value of 'this' used to invoke the mapfn.
  2159. */
  2160. from<T>(
  2161. arrayLike: ArrayLike<T>,
  2162. mapfn: (v: T, k: number) => number,
  2163. thisArg?: any
  2164. ): Int8Array
  2165. }
  2166. declare var Int8Array: Int8ArrayConstructor
  2167. /**
  2168. * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the
  2169. * requested number of bytes could not be allocated an exception is raised.
  2170. */
  2171. interface Uint8Array {
  2172. /**
  2173. * The size in bytes of each element in the array.
  2174. */
  2175. readonly BYTES_PER_ELEMENT: number
  2176. /**
  2177. * The ArrayBuffer instance referenced by the array.
  2178. */
  2179. readonly buffer: ArrayBufferLike
  2180. /**
  2181. * The length in bytes of the array.
  2182. */
  2183. readonly byteLength: number
  2184. /**
  2185. * The offset in bytes of the array.
  2186. */
  2187. readonly byteOffset: number
  2188. /**
  2189. * Returns the this object after copying a section of the array identified by start and end
  2190. * to the same array starting at position target
  2191. * @param target If target is negative, it is treated as length+target where length is the
  2192. * length of the array.
  2193. * @param start If start is negative, it is treated as length+start. If end is negative, it
  2194. * is treated as length+end.
  2195. * @param end If not specified, length of the this object is used as its default value.
  2196. */
  2197. copyWithin(target: number, start: number, end?: number): this
  2198. /**
  2199. * Determines whether all the members of an array satisfy the specified test.
  2200. * @param predicate A function that accepts up to three arguments. The every method calls
  2201. * the predicate function for each element in the array until the predicate returns a value
  2202. * which is coercible to the Boolean value false, or until the end of the array.
  2203. * @param thisArg An object to which the this keyword can refer in the predicate function.
  2204. * If thisArg is omitted, undefined is used as the this value.
  2205. */
  2206. every(
  2207. predicate: (value: number, index: number, array: Uint8Array) => unknown,
  2208. thisArg?: any
  2209. ): boolean
  2210. /**
  2211. * Changes all array elements from \`start\` to \`end\` index to a static \`value\` and returns the modified array
  2212. * @param value value to fill array section with
  2213. * @param start index to start filling the array at. If start is negative, it is treated as
  2214. * length+start where length is the length of the array.
  2215. * @param end index to stop filling the array at. If end is negative, it is treated as
  2216. * length+end.
  2217. */
  2218. fill(value: number, start?: number, end?: number): this
  2219. /**
  2220. * Returns the elements of an array that meet the condition specified in a callback function.
  2221. * @param predicate A function that accepts up to three arguments. The filter method calls
  2222. * the predicate function one time for each element in the array.
  2223. * @param thisArg An object to which the this keyword can refer in the predicate function.
  2224. * If thisArg is omitted, undefined is used as the this value.
  2225. */
  2226. filter(
  2227. predicate: (value: number, index: number, array: Uint8Array) => any,
  2228. thisArg?: any
  2229. ): Uint8Array
  2230. /**
  2231. * Returns the value of the first element in the array where predicate is true, and undefined
  2232. * otherwise.
  2233. * @param predicate find calls predicate once for each element of the array, in ascending
  2234. * order, until it finds one where predicate returns true. If such an element is found, find
  2235. * immediately returns that element value. Otherwise, find returns undefined.
  2236. * @param thisArg If provided, it will be used as the this value for each invocation of
  2237. * predicate. If it is not provided, undefined is used instead.
  2238. */
  2239. find(
  2240. predicate: (value: number, index: number, obj: Uint8Array) => boolean,
  2241. thisArg?: any
  2242. ): number | undefined
  2243. /**
  2244. * Returns the index of the first element in the array where predicate is true, and -1
  2245. * otherwise.
  2246. * @param predicate find calls predicate once for each element of the array, in ascending
  2247. * order, until it finds one where predicate returns true. If such an element is found,
  2248. * findIndex immediately returns that element index. Otherwise, findIndex returns -1.
  2249. * @param thisArg If provided, it will be used as the this value for each invocation of
  2250. * predicate. If it is not provided, undefined is used instead.
  2251. */
  2252. findIndex(
  2253. predicate: (value: number, index: number, obj: Uint8Array) => boolean,
  2254. thisArg?: any
  2255. ): number
  2256. /**
  2257. * Performs the specified action for each element in an array.
  2258. * @param callbackfn A function that accepts up to three arguments. forEach calls the
  2259. * callbackfn function one time for each element in the array.
  2260. * @param thisArg An object to which the this keyword can refer in the callbackfn function.
  2261. * If thisArg is omitted, undefined is used as the this value.
  2262. */
  2263. forEach(
  2264. callbackfn: (value: number, index: number, array: Uint8Array) => void,
  2265. thisArg?: any
  2266. ): void
  2267. /**
  2268. * Returns the index of the first occurrence of a value in an array.
  2269. * @param searchElement The value to locate in the array.
  2270. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
  2271. * search starts at index 0.
  2272. */
  2273. indexOf(searchElement: number, fromIndex?: number): number
  2274. /**
  2275. * Adds all the elements of an array separated by the specified separator string.
  2276. * @param separator A string used to separate one element of an array from the next in the
  2277. * resulting String. If omitted, the array elements are separated with a comma.
  2278. */
  2279. join(separator?: string): string
  2280. /**
  2281. * Returns the index of the last occurrence of a value in an array.
  2282. * @param searchElement The value to locate in the array.
  2283. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
  2284. * search starts at index 0.
  2285. */
  2286. lastIndexOf(searchElement: number, fromIndex?: number): number
  2287. /**
  2288. * The length of the array.
  2289. */
  2290. readonly length: number
  2291. /**
  2292. * Calls a defined callback function on each element of an array, and returns an array that
  2293. * contains the results.
  2294. * @param callbackfn A function that accepts up to three arguments. The map method calls the
  2295. * callbackfn function one time for each element in the array.
  2296. * @param thisArg An object to which the this keyword can refer in the callbackfn function.
  2297. * If thisArg is omitted, undefined is used as the this value.
  2298. */
  2299. map(
  2300. callbackfn: (value: number, index: number, array: Uint8Array) => number,
  2301. thisArg?: any
  2302. ): Uint8Array
  2303. /**
  2304. * Calls the specified callback function for all the elements in an array. The return value of
  2305. * the callback function is the accumulated result, and is provided as an argument in the next
  2306. * call to the callback function.
  2307. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the
  2308. * callbackfn function one time for each element in the array.
  2309. * @param initialValue If initialValue is specified, it is used as the initial value to start
  2310. * the accumulation. The first call to the callbackfn function provides this value as an argument
  2311. * instead of an array value.
  2312. */
  2313. reduce(
  2314. callbackfn: (
  2315. previousValue: number,
  2316. currentValue: number,
  2317. currentIndex: number,
  2318. array: Uint8Array
  2319. ) => number
  2320. ): number
  2321. reduce(
  2322. callbackfn: (
  2323. previousValue: number,
  2324. currentValue: number,
  2325. currentIndex: number,
  2326. array: Uint8Array
  2327. ) => number,
  2328. initialValue: number
  2329. ): number
  2330. /**
  2331. * Calls the specified callback function for all the elements in an array. The return value of
  2332. * the callback function is the accumulated result, and is provided as an argument in the next
  2333. * call to the callback function.
  2334. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the
  2335. * callbackfn function one time for each element in the array.
  2336. * @param initialValue If initialValue is specified, it is used as the initial value to start
  2337. * the accumulation. The first call to the callbackfn function provides this value as an argument
  2338. * instead of an array value.
  2339. */
  2340. reduce<U>(
  2341. callbackfn: (
  2342. previousValue: U,
  2343. currentValue: number,
  2344. currentIndex: number,
  2345. array: Uint8Array
  2346. ) => U,
  2347. initialValue: U
  2348. ): U
  2349. /**
  2350. * Calls the specified callback function for all the elements in an array, in descending order.
  2351. * The return value of the callback function is the accumulated result, and is provided as an
  2352. * argument in the next call to the callback function.
  2353. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
  2354. * the callbackfn function one time for each element in the array.
  2355. * @param initialValue If initialValue is specified, it is used as the initial value to start
  2356. * the accumulation. The first call to the callbackfn function provides this value as an
  2357. * argument instead of an array value.
  2358. */
  2359. reduceRight(
  2360. callbackfn: (
  2361. previousValue: number,
  2362. currentValue: number,
  2363. currentIndex: number,
  2364. array: Uint8Array
  2365. ) => number
  2366. ): number
  2367. reduceRight(
  2368. callbackfn: (
  2369. previousValue: number,
  2370. currentValue: number,
  2371. currentIndex: number,
  2372. array: Uint8Array
  2373. ) => number,
  2374. initialValue: number
  2375. ): number
  2376. /**
  2377. * Calls the specified callback function for all the elements in an array, in descending order.
  2378. * The return value of the callback function is the accumulated result, and is provided as an
  2379. * argument in the next call to the callback function.
  2380. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
  2381. * the callbackfn function one time for each element in the array.
  2382. * @param initialValue If initialValue is specified, it is used as the initial value to start
  2383. * the accumulation. The first call to the callbackfn function provides this value as an argument
  2384. * instead of an array value.
  2385. */
  2386. reduceRight<U>(
  2387. callbackfn: (
  2388. previousValue: U,
  2389. currentValue: number,
  2390. currentIndex: number,
  2391. array: Uint8Array
  2392. ) => U,
  2393. initialValue: U
  2394. ): U
  2395. /**
  2396. * Reverses the elements in an Array.
  2397. */
  2398. reverse(): Uint8Array
  2399. /**
  2400. * Sets a value or an array of values.
  2401. * @param array A typed or untyped array of values to set.
  2402. * @param offset The index in the current array at which the values are to be written.
  2403. */
  2404. set(array: ArrayLike<number>, offset?: number): void
  2405. /**
  2406. * Returns a section of an array.
  2407. * @param start The beginning of the specified portion of the array.
  2408. * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'.
  2409. */
  2410. slice(start?: number, end?: number): Uint8Array
  2411. /**
  2412. * Determines whether the specified callback function returns true for any element of an array.
  2413. * @param predicate A function that accepts up to three arguments. The some method calls
  2414. * the predicate function for each element in the array until the predicate returns a value
  2415. * which is coercible to the Boolean value true, or until the end of the array.
  2416. * @param thisArg An object to which the this keyword can refer in the predicate function.
  2417. * If thisArg is omitted, undefined is used as the this value.
  2418. */
  2419. some(
  2420. predicate: (value: number, index: number, array: Uint8Array) => unknown,
  2421. thisArg?: any
  2422. ): boolean
  2423. /**
  2424. * Sorts an array.
  2425. * @param compareFn Function used to determine the order of the elements. It is expected to return
  2426. * a negative value if first argument is less than second argument, zero if they're equal and a positive
  2427. * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
  2428. * \`\`\`ts
  2429. * [11,2,22,1].sort((a, b) => a - b)
  2430. * \`\`\`
  2431. */
  2432. sort(compareFn?: (a: number, b: number) => number): this
  2433. /**
  2434. * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements
  2435. * at begin, inclusive, up to end, exclusive.
  2436. * @param begin The index of the beginning of the array.
  2437. * @param end The index of the end of the array.
  2438. */
  2439. subarray(begin?: number, end?: number): Uint8Array
  2440. /**
  2441. * Converts a number to a string by using the current locale.
  2442. */
  2443. toLocaleString(): string
  2444. /**
  2445. * Returns a string representation of an array.
  2446. */
  2447. toString(): string
  2448. /** Returns the primitive value of the specified object. */
  2449. valueOf(): Uint8Array
  2450. [index: number]: number
  2451. }
  2452. interface Uint8ArrayConstructor {
  2453. readonly prototype: Uint8Array
  2454. new (length: number): Uint8Array
  2455. new (array: ArrayLike<number> | ArrayBufferLike): Uint8Array
  2456. new (
  2457. buffer: ArrayBufferLike,
  2458. byteOffset?: number,
  2459. length?: number
  2460. ): Uint8Array
  2461. /**
  2462. * The size in bytes of each element in the array.
  2463. */
  2464. readonly BYTES_PER_ELEMENT: number
  2465. /**
  2466. * Returns a new array from a set of elements.
  2467. * @param items A set of elements to include in the new array object.
  2468. */
  2469. of(...items: number[]): Uint8Array
  2470. /**
  2471. * Creates an array from an array-like or iterable object.
  2472. * @param arrayLike An array-like or iterable object to convert to an array.
  2473. */
  2474. from(arrayLike: ArrayLike<number>): Uint8Array
  2475. /**
  2476. * Creates an array from an array-like or iterable object.
  2477. * @param arrayLike An array-like or iterable object to convert to an array.
  2478. * @param mapfn A mapping function to call on every element of the array.
  2479. * @param thisArg Value of 'this' used to invoke the mapfn.
  2480. */
  2481. from<T>(
  2482. arrayLike: ArrayLike<T>,
  2483. mapfn: (v: T, k: number) => number,
  2484. thisArg?: any
  2485. ): Uint8Array
  2486. }
  2487. declare var Uint8Array: Uint8ArrayConstructor
  2488. /**
  2489. * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0.
  2490. * If the requested number of bytes could not be allocated an exception is raised.
  2491. */
  2492. interface Uint8ClampedArray {
  2493. /**
  2494. * The size in bytes of each element in the array.
  2495. */
  2496. readonly BYTES_PER_ELEMENT: number
  2497. /**
  2498. * The ArrayBuffer instance referenced by the array.
  2499. */
  2500. readonly buffer: ArrayBufferLike
  2501. /**
  2502. * The length in bytes of the array.
  2503. */
  2504. readonly byteLength: number
  2505. /**
  2506. * The offset in bytes of the array.
  2507. */
  2508. readonly byteOffset: number
  2509. /**
  2510. * Returns the this object after copying a section of the array identified by start and end
  2511. * to the same array starting at position target
  2512. * @param target If target is negative, it is treated as length+target where length is the
  2513. * length of the array.
  2514. * @param start If start is negative, it is treated as length+start. If end is negative, it
  2515. * is treated as length+end.
  2516. * @param end If not specified, length of the this object is used as its default value.
  2517. */
  2518. copyWithin(target: number, start: number, end?: number): this
  2519. /**
  2520. * Determines whether all the members of an array satisfy the specified test.
  2521. * @param predicate A function that accepts up to three arguments. The every method calls
  2522. * the predicate function for each element in the array until the predicate returns a value
  2523. * which is coercible to the Boolean value false, or until the end of the array.
  2524. * @param thisArg An object to which the this keyword can refer in the predicate function.
  2525. * If thisArg is omitted, undefined is used as the this value.
  2526. */
  2527. every(
  2528. predicate: (
  2529. value: number,
  2530. index: number,
  2531. array: Uint8ClampedArray
  2532. ) => unknown,
  2533. thisArg?: any
  2534. ): boolean
  2535. /**
  2536. * Changes all array elements from \`start\` to \`end\` index to a static \`value\` and returns the modified array
  2537. * @param value value to fill array section with
  2538. * @param start index to start filling the array at. If start is negative, it is treated as
  2539. * length+start where length is the length of the array.
  2540. * @param end index to stop filling the array at. If end is negative, it is treated as
  2541. * length+end.
  2542. */
  2543. fill(value: number, start?: number, end?: number): this
  2544. /**
  2545. * Returns the elements of an array that meet the condition specified in a callback function.
  2546. * @param predicate A function that accepts up to three arguments. The filter method calls
  2547. * the predicate function one time for each element in the array.
  2548. * @param thisArg An object to which the this keyword can refer in the predicate function.
  2549. * If thisArg is omitted, undefined is used as the this value.
  2550. */
  2551. filter(
  2552. predicate: (value: number, index: number, array: Uint8ClampedArray) => any,
  2553. thisArg?: any
  2554. ): Uint8ClampedArray
  2555. /**
  2556. * Returns the value of the first element in the array where predicate is true, and undefined
  2557. * otherwise.
  2558. * @param predicate find calls predicate once for each element of the array, in ascending
  2559. * order, until it finds one where predicate returns true. If such an element is found, find
  2560. * immediately returns that element value. Otherwise, find returns undefined.
  2561. * @param thisArg If provided, it will be used as the this value for each invocation of
  2562. * predicate. If it is not provided, undefined is used instead.
  2563. */
  2564. find(
  2565. predicate: (
  2566. value: number,
  2567. index: number,
  2568. obj: Uint8ClampedArray
  2569. ) => boolean,
  2570. thisArg?: any
  2571. ): number | undefined
  2572. /**
  2573. * Returns the index of the first element in the array where predicate is true, and -1
  2574. * otherwise.
  2575. * @param predicate find calls predicate once for each element of the array, in ascending
  2576. * order, until it finds one where predicate returns true. If such an element is found,
  2577. * findIndex immediately returns that element index. Otherwise, findIndex returns -1.
  2578. * @param thisArg If provided, it will be used as the this value for each invocation of
  2579. * predicate. If it is not provided, undefined is used instead.
  2580. */
  2581. findIndex(
  2582. predicate: (
  2583. value: number,
  2584. index: number,
  2585. obj: Uint8ClampedArray
  2586. ) => boolean,
  2587. thisArg?: any
  2588. ): number
  2589. /**
  2590. * Performs the specified action for each element in an array.
  2591. * @param callbackfn A function that accepts up to three arguments. forEach calls the
  2592. * callbackfn function one time for each element in the array.
  2593. * @param thisArg An object to which the this keyword can refer in the callbackfn function.
  2594. * If thisArg is omitted, undefined is used as the this value.
  2595. */
  2596. forEach(
  2597. callbackfn: (
  2598. value: number,
  2599. index: number,
  2600. array: Uint8ClampedArray
  2601. ) => void,
  2602. thisArg?: any
  2603. ): void
  2604. /**
  2605. * Returns the index of the first occurrence of a value in an array.
  2606. * @param searchElement The value to locate in the array.
  2607. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
  2608. * search starts at index 0.
  2609. */
  2610. indexOf(searchElement: number, fromIndex?: number): number
  2611. /**
  2612. * Adds all the elements of an array separated by the specified separator string.
  2613. * @param separator A string used to separate one element of an array from the next in the
  2614. * resulting String. If omitted, the array elements are separated with a comma.
  2615. */
  2616. join(separator?: string): string
  2617. /**
  2618. * Returns the index of the last occurrence of a value in an array.
  2619. * @param searchElement The value to locate in the array.
  2620. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
  2621. * search starts at index 0.
  2622. */
  2623. lastIndexOf(searchElement: number, fromIndex?: number): number
  2624. /**
  2625. * The length of the array.
  2626. */
  2627. readonly length: number
  2628. /**
  2629. * Calls a defined callback function on each element of an array, and returns an array that
  2630. * contains the results.
  2631. * @param callbackfn A function that accepts up to three arguments. The map method calls the
  2632. * callbackfn function one time for each element in the array.
  2633. * @param thisArg An object to which the this keyword can refer in the callbackfn function.
  2634. * If thisArg is omitted, undefined is used as the this value.
  2635. */
  2636. map(
  2637. callbackfn: (
  2638. value: number,
  2639. index: number,
  2640. array: Uint8ClampedArray
  2641. ) => number,
  2642. thisArg?: any
  2643. ): Uint8ClampedArray
  2644. /**
  2645. * Calls the specified callback function for all the elements in an array. The return value of
  2646. * the callback function is the accumulated result, and is provided as an argument in the next
  2647. * call to the callback function.
  2648. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the
  2649. * callbackfn function one time for each element in the array.
  2650. * @param initialValue If initialValue is specified, it is used as the initial value to start
  2651. * the accumulation. The first call to the callbackfn function provides this value as an argument
  2652. * instead of an array value.
  2653. */
  2654. reduce(
  2655. callbackfn: (
  2656. previousValue: number,
  2657. currentValue: number,
  2658. currentIndex: number,
  2659. array: Uint8ClampedArray
  2660. ) => number
  2661. ): number
  2662. reduce(
  2663. callbackfn: (
  2664. previousValue: number,
  2665. currentValue: number,
  2666. currentIndex: number,
  2667. array: Uint8ClampedArray
  2668. ) => number,
  2669. initialValue: number
  2670. ): number
  2671. /**
  2672. * Calls the specified callback function for all the elements in an array. The return value of
  2673. * the callback function is the accumulated result, and is provided as an argument in the next
  2674. * call to the callback function.
  2675. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the
  2676. * callbackfn function one time for each element in the array.
  2677. * @param initialValue If initialValue is specified, it is used as the initial value to start
  2678. * the accumulation. The first call to the callbackfn function provides this value as an argument
  2679. * instead of an array value.
  2680. */
  2681. reduce<U>(
  2682. callbackfn: (
  2683. previousValue: U,
  2684. currentValue: number,
  2685. currentIndex: number,
  2686. array: Uint8ClampedArray
  2687. ) => U,
  2688. initialValue: U
  2689. ): U
  2690. /**
  2691. * Calls the specified callback function for all the elements in an array, in descending order.
  2692. * The return value of the callback function is the accumulated result, and is provided as an
  2693. * argument in the next call to the callback function.
  2694. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
  2695. * the callbackfn function one time for each element in the array.
  2696. * @param initialValue If initialValue is specified, it is used as the initial value to start
  2697. * the accumulation. The first call to the callbackfn function provides this value as an
  2698. * argument instead of an array value.
  2699. */
  2700. reduceRight(
  2701. callbackfn: (
  2702. previousValue: number,
  2703. currentValue: number,
  2704. currentIndex: number,
  2705. array: Uint8ClampedArray
  2706. ) => number
  2707. ): number
  2708. reduceRight(
  2709. callbackfn: (
  2710. previousValue: number,
  2711. currentValue: number,
  2712. currentIndex: number,
  2713. array: Uint8ClampedArray
  2714. ) => number,
  2715. initialValue: number
  2716. ): number
  2717. /**
  2718. * Calls the specified callback function for all the elements in an array, in descending order.
  2719. * The return value of the callback function is the accumulated result, and is provided as an
  2720. * argument in the next call to the callback function.
  2721. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
  2722. * the callbackfn function one time for each element in the array.
  2723. * @param initialValue If initialValue is specified, it is used as the initial value to start
  2724. * the accumulation. The first call to the callbackfn function provides this value as an argument
  2725. * instead of an array value.
  2726. */
  2727. reduceRight<U>(
  2728. callbackfn: (
  2729. previousValue: U,
  2730. currentValue: number,
  2731. currentIndex: number,
  2732. array: Uint8ClampedArray
  2733. ) => U,
  2734. initialValue: U
  2735. ): U
  2736. /**
  2737. * Reverses the elements in an Array.
  2738. */
  2739. reverse(): Uint8ClampedArray
  2740. /**
  2741. * Sets a value or an array of values.
  2742. * @param array A typed or untyped array of values to set.
  2743. * @param offset The index in the current array at which the values are to be written.
  2744. */
  2745. set(array: ArrayLike<number>, offset?: number): void
  2746. /**
  2747. * Returns a section of an array.
  2748. * @param start The beginning of the specified portion of the array.
  2749. * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'.
  2750. */
  2751. slice(start?: number, end?: number): Uint8ClampedArray
  2752. /**
  2753. * Determines whether the specified callback function returns true for any element of an array.
  2754. * @param predicate A function that accepts up to three arguments. The some method calls
  2755. * the predicate function for each element in the array until the predicate returns a value
  2756. * which is coercible to the Boolean value true, or until the end of the array.
  2757. * @param thisArg An object to which the this keyword can refer in the predicate function.
  2758. * If thisArg is omitted, undefined is used as the this value.
  2759. */
  2760. some(
  2761. predicate: (
  2762. value: number,
  2763. index: number,
  2764. array: Uint8ClampedArray
  2765. ) => unknown,
  2766. thisArg?: any
  2767. ): boolean
  2768. /**
  2769. * Sorts an array.
  2770. * @param compareFn Function used to determine the order of the elements. It is expected to return
  2771. * a negative value if first argument is less than second argument, zero if they're equal and a positive
  2772. * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
  2773. * \`\`\`ts
  2774. * [11,2,22,1].sort((a, b) => a - b)
  2775. * \`\`\`
  2776. */
  2777. sort(compareFn?: (a: number, b: number) => number): this
  2778. /**
  2779. * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements
  2780. * at begin, inclusive, up to end, exclusive.
  2781. * @param begin The index of the beginning of the array.
  2782. * @param end The index of the end of the array.
  2783. */
  2784. subarray(begin?: number, end?: number): Uint8ClampedArray
  2785. /**
  2786. * Converts a number to a string by using the current locale.
  2787. */
  2788. toLocaleString(): string
  2789. /**
  2790. * Returns a string representation of an array.
  2791. */
  2792. toString(): string
  2793. /** Returns the primitive value of the specified object. */
  2794. valueOf(): Uint8ClampedArray
  2795. [index: number]: number
  2796. }
  2797. interface Uint8ClampedArrayConstructor {
  2798. readonly prototype: Uint8ClampedArray
  2799. new (length: number): Uint8ClampedArray
  2800. new (array: ArrayLike<number> | ArrayBufferLike): Uint8ClampedArray
  2801. new (
  2802. buffer: ArrayBufferLike,
  2803. byteOffset?: number,
  2804. length?: number
  2805. ): Uint8ClampedArray
  2806. /**
  2807. * The size in bytes of each element in the array.
  2808. */
  2809. readonly BYTES_PER_ELEMENT: number
  2810. /**
  2811. * Returns a new array from a set of elements.
  2812. * @param items A set of elements to include in the new array object.
  2813. */
  2814. of(...items: number[]): Uint8ClampedArray
  2815. /**
  2816. * Creates an array from an array-like or iterable object.
  2817. * @param arrayLike An array-like or iterable object to convert to an array.
  2818. */
  2819. from(arrayLike: ArrayLike<number>): Uint8ClampedArray
  2820. /**
  2821. * Creates an array from an array-like or iterable object.
  2822. * @param arrayLike An array-like or iterable object to convert to an array.
  2823. * @param mapfn A mapping function to call on every element of the array.
  2824. * @param thisArg Value of 'this' used to invoke the mapfn.
  2825. */
  2826. from<T>(
  2827. arrayLike: ArrayLike<T>,
  2828. mapfn: (v: T, k: number) => number,
  2829. thisArg?: any
  2830. ): Uint8ClampedArray
  2831. }
  2832. declare var Uint8ClampedArray: Uint8ClampedArrayConstructor
  2833. /**
  2834. * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the
  2835. * requested number of bytes could not be allocated an exception is raised.
  2836. */
  2837. interface Int16Array {
  2838. /**
  2839. * The size in bytes of each element in the array.
  2840. */
  2841. readonly BYTES_PER_ELEMENT: number
  2842. /**
  2843. * The ArrayBuffer instance referenced by the array.
  2844. */
  2845. readonly buffer: ArrayBufferLike
  2846. /**
  2847. * The length in bytes of the array.
  2848. */
  2849. readonly byteLength: number
  2850. /**
  2851. * The offset in bytes of the array.
  2852. */
  2853. readonly byteOffset: number
  2854. /**
  2855. * Returns the this object after copying a section of the array identified by start and end
  2856. * to the same array starting at position target
  2857. * @param target If target is negative, it is treated as length+target where length is the
  2858. * length of the array.
  2859. * @param start If start is negative, it is treated as length+start. If end is negative, it
  2860. * is treated as length+end.
  2861. * @param end If not specified, length of the this object is used as its default value.
  2862. */
  2863. copyWithin(target: number, start: number, end?: number): this
  2864. /**
  2865. * Determines whether all the members of an array satisfy the specified test.
  2866. * @param predicate A function that accepts up to three arguments. The every method calls
  2867. * the predicate function for each element in the array until the predicate returns a value
  2868. * which is coercible to the Boolean value false, or until the end of the array.
  2869. * @param thisArg An object to which the this keyword can refer in the predicate function.
  2870. * If thisArg is omitted, undefined is used as the this value.
  2871. */
  2872. every(
  2873. predicate: (value: number, index: number, array: Int16Array) => unknown,
  2874. thisArg?: any
  2875. ): boolean
  2876. /**
  2877. * Changes all array elements from \`start\` to \`end\` index to a static \`value\` and returns the modified array
  2878. * @param value value to fill array section with
  2879. * @param start index to start filling the array at. If start is negative, it is treated as
  2880. * length+start where length is the length of the array.
  2881. * @param end index to stop filling the array at. If end is negative, it is treated as
  2882. * length+end.
  2883. */
  2884. fill(value: number, start?: number, end?: number): this
  2885. /**
  2886. * Returns the elements of an array that meet the condition specified in a callback function.
  2887. * @param predicate A function that accepts up to three arguments. The filter method calls
  2888. * the predicate function one time for each element in the array.
  2889. * @param thisArg An object to which the this keyword can refer in the predicate function.
  2890. * If thisArg is omitted, undefined is used as the this value.
  2891. */
  2892. filter(
  2893. predicate: (value: number, index: number, array: Int16Array) => any,
  2894. thisArg?: any
  2895. ): Int16Array
  2896. /**
  2897. * Returns the value of the first element in the array where predicate is true, and undefined
  2898. * otherwise.
  2899. * @param predicate find calls predicate once for each element of the array, in ascending
  2900. * order, until it finds one where predicate returns true. If such an element is found, find
  2901. * immediately returns that element value. Otherwise, find returns undefined.
  2902. * @param thisArg If provided, it will be used as the this value for each invocation of
  2903. * predicate. If it is not provided, undefined is used instead.
  2904. */
  2905. find(
  2906. predicate: (value: number, index: number, obj: Int16Array) => boolean,
  2907. thisArg?: any
  2908. ): number | undefined
  2909. /**
  2910. * Returns the index of the first element in the array where predicate is true, and -1
  2911. * otherwise.
  2912. * @param predicate find calls predicate once for each element of the array, in ascending
  2913. * order, until it finds one where predicate returns true. If such an element is found,
  2914. * findIndex immediately returns that element index. Otherwise, findIndex returns -1.
  2915. * @param thisArg If provided, it will be used as the this value for each invocation of
  2916. * predicate. If it is not provided, undefined is used instead.
  2917. */
  2918. findIndex(
  2919. predicate: (value: number, index: number, obj: Int16Array) => boolean,
  2920. thisArg?: any
  2921. ): number
  2922. /**
  2923. * Performs the specified action for each element in an array.
  2924. * @param callbackfn A function that accepts up to three arguments. forEach calls the
  2925. * callbackfn function one time for each element in the array.
  2926. * @param thisArg An object to which the this keyword can refer in the callbackfn function.
  2927. * If thisArg is omitted, undefined is used as the this value.
  2928. */
  2929. forEach(
  2930. callbackfn: (value: number, index: number, array: Int16Array) => void,
  2931. thisArg?: any
  2932. ): void
  2933. /**
  2934. * Returns the index of the first occurrence of a value in an array.
  2935. * @param searchElement The value to locate in the array.
  2936. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
  2937. * search starts at index 0.
  2938. */
  2939. indexOf(searchElement: number, fromIndex?: number): number
  2940. /**
  2941. * Adds all the elements of an array separated by the specified separator string.
  2942. * @param separator A string used to separate one element of an array from the next in the
  2943. * resulting String. If omitted, the array elements are separated with a comma.
  2944. */
  2945. join(separator?: string): string
  2946. /**
  2947. * Returns the index of the last occurrence of a value in an array.
  2948. * @param searchElement The value to locate in the array.
  2949. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
  2950. * search starts at index 0.
  2951. */
  2952. lastIndexOf(searchElement: number, fromIndex?: number): number
  2953. /**
  2954. * The length of the array.
  2955. */
  2956. readonly length: number
  2957. /**
  2958. * Calls a defined callback function on each element of an array, and returns an array that
  2959. * contains the results.
  2960. * @param callbackfn A function that accepts up to three arguments. The map method calls the
  2961. * callbackfn function one time for each element in the array.
  2962. * @param thisArg An object to which the this keyword can refer in the callbackfn function.
  2963. * If thisArg is omitted, undefined is used as the this value.
  2964. */
  2965. map(
  2966. callbackfn: (value: number, index: number, array: Int16Array) => number,
  2967. thisArg?: any
  2968. ): Int16Array
  2969. /**
  2970. * Calls the specified callback function for all the elements in an array. The return value of
  2971. * the callback function is the accumulated result, and is provided as an argument in the next
  2972. * call to the callback function.
  2973. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the
  2974. * callbackfn function one time for each element in the array.
  2975. * @param initialValue If initialValue is specified, it is used as the initial value to start
  2976. * the accumulation. The first call to the callbackfn function provides this value as an argument
  2977. * instead of an array value.
  2978. */
  2979. reduce(
  2980. callbackfn: (
  2981. previousValue: number,
  2982. currentValue: number,
  2983. currentIndex: number,
  2984. array: Int16Array
  2985. ) => number
  2986. ): number
  2987. reduce(
  2988. callbackfn: (
  2989. previousValue: number,
  2990. currentValue: number,
  2991. currentIndex: number,
  2992. array: Int16Array
  2993. ) => number,
  2994. initialValue: number
  2995. ): number
  2996. /**
  2997. * Calls the specified callback function for all the elements in an array. The return value of
  2998. * the callback function is the accumulated result, and is provided as an argument in the next
  2999. * call to the callback function.
  3000. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the
  3001. * callbackfn function one time for each element in the array.
  3002. * @param initialValue If initialValue is specified, it is used as the initial value to start
  3003. * the accumulation. The first call to the callbackfn function provides this value as an argument
  3004. * instead of an array value.
  3005. */
  3006. reduce<U>(
  3007. callbackfn: (
  3008. previousValue: U,
  3009. currentValue: number,
  3010. currentIndex: number,
  3011. array: Int16Array
  3012. ) => U,
  3013. initialValue: U
  3014. ): U
  3015. /**
  3016. * Calls the specified callback function for all the elements in an array, in descending order.
  3017. * The return value of the callback function is the accumulated result, and is provided as an
  3018. * argument in the next call to the callback function.
  3019. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
  3020. * the callbackfn function one time for each element in the array.
  3021. * @param initialValue If initialValue is specified, it is used as the initial value to start
  3022. * the accumulation. The first call to the callbackfn function provides this value as an
  3023. * argument instead of an array value.
  3024. */
  3025. reduceRight(
  3026. callbackfn: (
  3027. previousValue: number,
  3028. currentValue: number,
  3029. currentIndex: number,
  3030. array: Int16Array
  3031. ) => number
  3032. ): number
  3033. reduceRight(
  3034. callbackfn: (
  3035. previousValue: number,
  3036. currentValue: number,
  3037. currentIndex: number,
  3038. array: Int16Array
  3039. ) => number,
  3040. initialValue: number
  3041. ): number
  3042. /**
  3043. * Calls the specified callback function for all the elements in an array, in descending order.
  3044. * The return value of the callback function is the accumulated result, and is provided as an
  3045. * argument in the next call to the callback function.
  3046. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
  3047. * the callbackfn function one time for each element in the array.
  3048. * @param initialValue If initialValue is specified, it is used as the initial value to start
  3049. * the accumulation. The first call to the callbackfn function provides this value as an argument
  3050. * instead of an array value.
  3051. */
  3052. reduceRight<U>(
  3053. callbackfn: (
  3054. previousValue: U,
  3055. currentValue: number,
  3056. currentIndex: number,
  3057. array: Int16Array
  3058. ) => U,
  3059. initialValue: U
  3060. ): U
  3061. /**
  3062. * Reverses the elements in an Array.
  3063. */
  3064. reverse(): Int16Array
  3065. /**
  3066. * Sets a value or an array of values.
  3067. * @param array A typed or untyped array of values to set.
  3068. * @param offset The index in the current array at which the values are to be written.
  3069. */
  3070. set(array: ArrayLike<number>, offset?: number): void
  3071. /**
  3072. * Returns a section of an array.
  3073. * @param start The beginning of the specified portion of the array.
  3074. * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'.
  3075. */
  3076. slice(start?: number, end?: number): Int16Array
  3077. /**
  3078. * Determines whether the specified callback function returns true for any element of an array.
  3079. * @param predicate A function that accepts up to three arguments. The some method calls
  3080. * the predicate function for each element in the array until the predicate returns a value
  3081. * which is coercible to the Boolean value true, or until the end of the array.
  3082. * @param thisArg An object to which the this keyword can refer in the predicate function.
  3083. * If thisArg is omitted, undefined is used as the this value.
  3084. */
  3085. some(
  3086. predicate: (value: number, index: number, array: Int16Array) => unknown,
  3087. thisArg?: any
  3088. ): boolean
  3089. /**
  3090. * Sorts an array.
  3091. * @param compareFn Function used to determine the order of the elements. It is expected to return
  3092. * a negative value if first argument is less than second argument, zero if they're equal and a positive
  3093. * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
  3094. * \`\`\`ts
  3095. * [11,2,22,1].sort((a, b) => a - b)
  3096. * \`\`\`
  3097. */
  3098. sort(compareFn?: (a: number, b: number) => number): this
  3099. /**
  3100. * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements
  3101. * at begin, inclusive, up to end, exclusive.
  3102. * @param begin The index of the beginning of the array.
  3103. * @param end The index of the end of the array.
  3104. */
  3105. subarray(begin?: number, end?: number): Int16Array
  3106. /**
  3107. * Converts a number to a string by using the current locale.
  3108. */
  3109. toLocaleString(): string
  3110. /**
  3111. * Returns a string representation of an array.
  3112. */
  3113. toString(): string
  3114. /** Returns the primitive value of the specified object. */
  3115. valueOf(): Int16Array
  3116. [index: number]: number
  3117. }
  3118. interface Int16ArrayConstructor {
  3119. readonly prototype: Int16Array
  3120. new (length: number): Int16Array
  3121. new (array: ArrayLike<number> | ArrayBufferLike): Int16Array
  3122. new (
  3123. buffer: ArrayBufferLike,
  3124. byteOffset?: number,
  3125. length?: number
  3126. ): Int16Array
  3127. /**
  3128. * The size in bytes of each element in the array.
  3129. */
  3130. readonly BYTES_PER_ELEMENT: number
  3131. /**
  3132. * Returns a new array from a set of elements.
  3133. * @param items A set of elements to include in the new array object.
  3134. */
  3135. of(...items: number[]): Int16Array
  3136. /**
  3137. * Creates an array from an array-like or iterable object.
  3138. * @param arrayLike An array-like or iterable object to convert to an array.
  3139. */
  3140. from(arrayLike: ArrayLike<number>): Int16Array
  3141. /**
  3142. * Creates an array from an array-like or iterable object.
  3143. * @param arrayLike An array-like or iterable object to convert to an array.
  3144. * @param mapfn A mapping function to call on every element of the array.
  3145. * @param thisArg Value of 'this' used to invoke the mapfn.
  3146. */
  3147. from<T>(
  3148. arrayLike: ArrayLike<T>,
  3149. mapfn: (v: T, k: number) => number,
  3150. thisArg?: any
  3151. ): Int16Array
  3152. }
  3153. declare var Int16Array: Int16ArrayConstructor
  3154. /**
  3155. * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the
  3156. * requested number of bytes could not be allocated an exception is raised.
  3157. */
  3158. interface Uint16Array {
  3159. /**
  3160. * The size in bytes of each element in the array.
  3161. */
  3162. readonly BYTES_PER_ELEMENT: number
  3163. /**
  3164. * The ArrayBuffer instance referenced by the array.
  3165. */
  3166. readonly buffer: ArrayBufferLike
  3167. /**
  3168. * The length in bytes of the array.
  3169. */
  3170. readonly byteLength: number
  3171. /**
  3172. * The offset in bytes of the array.
  3173. */
  3174. readonly byteOffset: number
  3175. /**
  3176. * Returns the this object after copying a section of the array identified by start and end
  3177. * to the same array starting at position target
  3178. * @param target If target is negative, it is treated as length+target where length is the
  3179. * length of the array.
  3180. * @param start If start is negative, it is treated as length+start. If end is negative, it
  3181. * is treated as length+end.
  3182. * @param end If not specified, length of the this object is used as its default value.
  3183. */
  3184. copyWithin(target: number, start: number, end?: number): this
  3185. /**
  3186. * Determines whether all the members of an array satisfy the specified test.
  3187. * @param predicate A function that accepts up to three arguments. The every method calls
  3188. * the predicate function for each element in the array until the predicate returns a value
  3189. * which is coercible to the Boolean value false, or until the end of the array.
  3190. * @param thisArg An object to which the this keyword can refer in the predicate function.
  3191. * If thisArg is omitted, undefined is used as the this value.
  3192. */
  3193. every(
  3194. predicate: (value: number, index: number, array: Uint16Array) => unknown,
  3195. thisArg?: any
  3196. ): boolean
  3197. /**
  3198. * Changes all array elements from \`start\` to \`end\` index to a static \`value\` and returns the modified array
  3199. * @param value value to fill array section with
  3200. * @param start index to start filling the array at. If start is negative, it is treated as
  3201. * length+start where length is the length of the array.
  3202. * @param end index to stop filling the array at. If end is negative, it is treated as
  3203. * length+end.
  3204. */
  3205. fill(value: number, start?: number, end?: number): this
  3206. /**
  3207. * Returns the elements of an array that meet the condition specified in a callback function.
  3208. * @param predicate A function that accepts up to three arguments. The filter method calls
  3209. * the predicate function one time for each element in the array.
  3210. * @param thisArg An object to which the this keyword can refer in the predicate function.
  3211. * If thisArg is omitted, undefined is used as the this value.
  3212. */
  3213. filter(
  3214. predicate: (value: number, index: number, array: Uint16Array) => any,
  3215. thisArg?: any
  3216. ): Uint16Array
  3217. /**
  3218. * Returns the value of the first element in the array where predicate is true, and undefined
  3219. * otherwise.
  3220. * @param predicate find calls predicate once for each element of the array, in ascending
  3221. * order, until it finds one where predicate returns true. If such an element is found, find
  3222. * immediately returns that element value. Otherwise, find returns undefined.
  3223. * @param thisArg If provided, it will be used as the this value for each invocation of
  3224. * predicate. If it is not provided, undefined is used instead.
  3225. */
  3226. find(
  3227. predicate: (value: number, index: number, obj: Uint16Array) => boolean,
  3228. thisArg?: any
  3229. ): number | undefined
  3230. /**
  3231. * Returns the index of the first element in the array where predicate is true, and -1
  3232. * otherwise.
  3233. * @param predicate find calls predicate once for each element of the array, in ascending
  3234. * order, until it finds one where predicate returns true. If such an element is found,
  3235. * findIndex immediately returns that element index. Otherwise, findIndex returns -1.
  3236. * @param thisArg If provided, it will be used as the this value for each invocation of
  3237. * predicate. If it is not provided, undefined is used instead.
  3238. */
  3239. findIndex(
  3240. predicate: (value: number, index: number, obj: Uint16Array) => boolean,
  3241. thisArg?: any
  3242. ): number
  3243. /**
  3244. * Performs the specified action for each element in an array.
  3245. * @param callbackfn A function that accepts up to three arguments. forEach calls the
  3246. * callbackfn function one time for each element in the array.
  3247. * @param thisArg An object to which the this keyword can refer in the callbackfn function.
  3248. * If thisArg is omitted, undefined is used as the this value.
  3249. */
  3250. forEach(
  3251. callbackfn: (value: number, index: number, array: Uint16Array) => void,
  3252. thisArg?: any
  3253. ): void
  3254. /**
  3255. * Returns the index of the first occurrence of a value in an array.
  3256. * @param searchElement The value to locate in the array.
  3257. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
  3258. * search starts at index 0.
  3259. */
  3260. indexOf(searchElement: number, fromIndex?: number): number
  3261. /**
  3262. * Adds all the elements of an array separated by the specified separator string.
  3263. * @param separator A string used to separate one element of an array from the next in the
  3264. * resulting String. If omitted, the array elements are separated with a comma.
  3265. */
  3266. join(separator?: string): string
  3267. /**
  3268. * Returns the index of the last occurrence of a value in an array.
  3269. * @param searchElement The value to locate in the array.
  3270. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
  3271. * search starts at index 0.
  3272. */
  3273. lastIndexOf(searchElement: number, fromIndex?: number): number
  3274. /**
  3275. * The length of the array.
  3276. */
  3277. readonly length: number
  3278. /**
  3279. * Calls a defined callback function on each element of an array, and returns an array that
  3280. * contains the results.
  3281. * @param callbackfn A function that accepts up to three arguments. The map method calls the
  3282. * callbackfn function one time for each element in the array.
  3283. * @param thisArg An object to which the this keyword can refer in the callbackfn function.
  3284. * If thisArg is omitted, undefined is used as the this value.
  3285. */
  3286. map(
  3287. callbackfn: (value: number, index: number, array: Uint16Array) => number,
  3288. thisArg?: any
  3289. ): Uint16Array
  3290. /**
  3291. * Calls the specified callback function for all the elements in an array. The return value of
  3292. * the callback function is the accumulated result, and is provided as an argument in the next
  3293. * call to the callback function.
  3294. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the
  3295. * callbackfn function one time for each element in the array.
  3296. * @param initialValue If initialValue is specified, it is used as the initial value to start
  3297. * the accumulation. The first call to the callbackfn function provides this value as an argument
  3298. * instead of an array value.
  3299. */
  3300. reduce(
  3301. callbackfn: (
  3302. previousValue: number,
  3303. currentValue: number,
  3304. currentIndex: number,
  3305. array: Uint16Array
  3306. ) => number
  3307. ): number
  3308. reduce(
  3309. callbackfn: (
  3310. previousValue: number,
  3311. currentValue: number,
  3312. currentIndex: number,
  3313. array: Uint16Array
  3314. ) => number,
  3315. initialValue: number
  3316. ): number
  3317. /**
  3318. * Calls the specified callback function for all the elements in an array. The return value of
  3319. * the callback function is the accumulated result, and is provided as an argument in the next
  3320. * call to the callback function.
  3321. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the
  3322. * callbackfn function one time for each element in the array.
  3323. * @param initialValue If initialValue is specified, it is used as the initial value to start
  3324. * the accumulation. The first call to the callbackfn function provides this value as an argument
  3325. * instead of an array value.
  3326. */
  3327. reduce<U>(
  3328. callbackfn: (
  3329. previousValue: U,
  3330. currentValue: number,
  3331. currentIndex: number,
  3332. array: Uint16Array
  3333. ) => U,
  3334. initialValue: U
  3335. ): U
  3336. /**
  3337. * Calls the specified callback function for all the elements in an array, in descending order.
  3338. * The return value of the callback function is the accumulated result, and is provided as an
  3339. * argument in the next call to the callback function.
  3340. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
  3341. * the callbackfn function one time for each element in the array.
  3342. * @param initialValue If initialValue is specified, it is used as the initial value to start
  3343. * the accumulation. The first call to the callbackfn function provides this value as an
  3344. * argument instead of an array value.
  3345. */
  3346. reduceRight(
  3347. callbackfn: (
  3348. previousValue: number,
  3349. currentValue: number,
  3350. currentIndex: number,
  3351. array: Uint16Array
  3352. ) => number
  3353. ): number
  3354. reduceRight(
  3355. callbackfn: (
  3356. previousValue: number,
  3357. currentValue: number,
  3358. currentIndex: number,
  3359. array: Uint16Array
  3360. ) => number,
  3361. initialValue: number
  3362. ): number
  3363. /**
  3364. * Calls the specified callback function for all the elements in an array, in descending order.
  3365. * The return value of the callback function is the accumulated result, and is provided as an
  3366. * argument in the next call to the callback function.
  3367. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
  3368. * the callbackfn function one time for each element in the array.
  3369. * @param initialValue If initialValue is specified, it is used as the initial value to start
  3370. * the accumulation. The first call to the callbackfn function provides this value as an argument
  3371. * instead of an array value.
  3372. */
  3373. reduceRight<U>(
  3374. callbackfn: (
  3375. previousValue: U,
  3376. currentValue: number,
  3377. currentIndex: number,
  3378. array: Uint16Array
  3379. ) => U,
  3380. initialValue: U
  3381. ): U
  3382. /**
  3383. * Reverses the elements in an Array.
  3384. */
  3385. reverse(): Uint16Array
  3386. /**
  3387. * Sets a value or an array of values.
  3388. * @param array A typed or untyped array of values to set.
  3389. * @param offset The index in the current array at which the values are to be written.
  3390. */
  3391. set(array: ArrayLike<number>, offset?: number): void
  3392. /**
  3393. * Returns a section of an array.
  3394. * @param start The beginning of the specified portion of the array.
  3395. * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'.
  3396. */
  3397. slice(start?: number, end?: number): Uint16Array
  3398. /**
  3399. * Determines whether the specified callback function returns true for any element of an array.
  3400. * @param predicate A function that accepts up to three arguments. The some method calls
  3401. * the predicate function for each element in the array until the predicate returns a value
  3402. * which is coercible to the Boolean value true, or until the end of the array.
  3403. * @param thisArg An object to which the this keyword can refer in the predicate function.
  3404. * If thisArg is omitted, undefined is used as the this value.
  3405. */
  3406. some(
  3407. predicate: (value: number, index: number, array: Uint16Array) => unknown,
  3408. thisArg?: any
  3409. ): boolean
  3410. /**
  3411. * Sorts an array.
  3412. * @param compareFn Function used to determine the order of the elements. It is expected to return
  3413. * a negative value if first argument is less than second argument, zero if they're equal and a positive
  3414. * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
  3415. * \`\`\`ts
  3416. * [11,2,22,1].sort((a, b) => a - b)
  3417. * \`\`\`
  3418. */
  3419. sort(compareFn?: (a: number, b: number) => number): this
  3420. /**
  3421. * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements
  3422. * at begin, inclusive, up to end, exclusive.
  3423. * @param begin The index of the beginning of the array.
  3424. * @param end The index of the end of the array.
  3425. */
  3426. subarray(begin?: number, end?: number): Uint16Array
  3427. /**
  3428. * Converts a number to a string by using the current locale.
  3429. */
  3430. toLocaleString(): string
  3431. /**
  3432. * Returns a string representation of an array.
  3433. */
  3434. toString(): string
  3435. /** Returns the primitive value of the specified object. */
  3436. valueOf(): Uint16Array
  3437. [index: number]: number
  3438. }
  3439. interface Uint16ArrayConstructor {
  3440. readonly prototype: Uint16Array
  3441. new (length: number): Uint16Array
  3442. new (array: ArrayLike<number> | ArrayBufferLike): Uint16Array
  3443. new (
  3444. buffer: ArrayBufferLike,
  3445. byteOffset?: number,
  3446. length?: number
  3447. ): Uint16Array
  3448. /**
  3449. * The size in bytes of each element in the array.
  3450. */
  3451. readonly BYTES_PER_ELEMENT: number
  3452. /**
  3453. * Returns a new array from a set of elements.
  3454. * @param items A set of elements to include in the new array object.
  3455. */
  3456. of(...items: number[]): Uint16Array
  3457. /**
  3458. * Creates an array from an array-like or iterable object.
  3459. * @param arrayLike An array-like or iterable object to convert to an array.
  3460. */
  3461. from(arrayLike: ArrayLike<number>): Uint16Array
  3462. /**
  3463. * Creates an array from an array-like or iterable object.
  3464. * @param arrayLike An array-like or iterable object to convert to an array.
  3465. * @param mapfn A mapping function to call on every element of the array.
  3466. * @param thisArg Value of 'this' used to invoke the mapfn.
  3467. */
  3468. from<T>(
  3469. arrayLike: ArrayLike<T>,
  3470. mapfn: (v: T, k: number) => number,
  3471. thisArg?: any
  3472. ): Uint16Array
  3473. }
  3474. declare var Uint16Array: Uint16ArrayConstructor
  3475. /**
  3476. * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the
  3477. * requested number of bytes could not be allocated an exception is raised.
  3478. */
  3479. interface Int32Array {
  3480. /**
  3481. * The size in bytes of each element in the array.
  3482. */
  3483. readonly BYTES_PER_ELEMENT: number
  3484. /**
  3485. * The ArrayBuffer instance referenced by the array.
  3486. */
  3487. readonly buffer: ArrayBufferLike
  3488. /**
  3489. * The length in bytes of the array.
  3490. */
  3491. readonly byteLength: number
  3492. /**
  3493. * The offset in bytes of the array.
  3494. */
  3495. readonly byteOffset: number
  3496. /**
  3497. * Returns the this object after copying a section of the array identified by start and end
  3498. * to the same array starting at position target
  3499. * @param target If target is negative, it is treated as length+target where length is the
  3500. * length of the array.
  3501. * @param start If start is negative, it is treated as length+start. If end is negative, it
  3502. * is treated as length+end.
  3503. * @param end If not specified, length of the this object is used as its default value.
  3504. */
  3505. copyWithin(target: number, start: number, end?: number): this
  3506. /**
  3507. * Determines whether all the members of an array satisfy the specified test.
  3508. * @param predicate A function that accepts up to three arguments. The every method calls
  3509. * the predicate function for each element in the array until the predicate returns a value
  3510. * which is coercible to the Boolean value false, or until the end of the array.
  3511. * @param thisArg An object to which the this keyword can refer in the predicate function.
  3512. * If thisArg is omitted, undefined is used as the this value.
  3513. */
  3514. every(
  3515. predicate: (value: number, index: number, array: Int32Array) => unknown,
  3516. thisArg?: any
  3517. ): boolean
  3518. /**
  3519. * Changes all array elements from \`start\` to \`end\` index to a static \`value\` and returns the modified array
  3520. * @param value value to fill array section with
  3521. * @param start index to start filling the array at. If start is negative, it is treated as
  3522. * length+start where length is the length of the array.
  3523. * @param end index to stop filling the array at. If end is negative, it is treated as
  3524. * length+end.
  3525. */
  3526. fill(value: number, start?: number, end?: number): this
  3527. /**
  3528. * Returns the elements of an array that meet the condition specified in a callback function.
  3529. * @param predicate A function that accepts up to three arguments. The filter method calls
  3530. * the predicate function one time for each element in the array.
  3531. * @param thisArg An object to which the this keyword can refer in the predicate function.
  3532. * If thisArg is omitted, undefined is used as the this value.
  3533. */
  3534. filter(
  3535. predicate: (value: number, index: number, array: Int32Array) => any,
  3536. thisArg?: any
  3537. ): Int32Array
  3538. /**
  3539. * Returns the value of the first element in the array where predicate is true, and undefined
  3540. * otherwise.
  3541. * @param predicate find calls predicate once for each element of the array, in ascending
  3542. * order, until it finds one where predicate returns true. If such an element is found, find
  3543. * immediately returns that element value. Otherwise, find returns undefined.
  3544. * @param thisArg If provided, it will be used as the this value for each invocation of
  3545. * predicate. If it is not provided, undefined is used instead.
  3546. */
  3547. find(
  3548. predicate: (value: number, index: number, obj: Int32Array) => boolean,
  3549. thisArg?: any
  3550. ): number | undefined
  3551. /**
  3552. * Returns the index of the first element in the array where predicate is true, and -1
  3553. * otherwise.
  3554. * @param predicate find calls predicate once for each element of the array, in ascending
  3555. * order, until it finds one where predicate returns true. If such an element is found,
  3556. * findIndex immediately returns that element index. Otherwise, findIndex returns -1.
  3557. * @param thisArg If provided, it will be used as the this value for each invocation of
  3558. * predicate. If it is not provided, undefined is used instead.
  3559. */
  3560. findIndex(
  3561. predicate: (value: number, index: number, obj: Int32Array) => boolean,
  3562. thisArg?: any
  3563. ): number
  3564. /**
  3565. * Performs the specified action for each element in an array.
  3566. * @param callbackfn A function that accepts up to three arguments. forEach calls the
  3567. * callbackfn function one time for each element in the array.
  3568. * @param thisArg An object to which the this keyword can refer in the callbackfn function.
  3569. * If thisArg is omitted, undefined is used as the this value.
  3570. */
  3571. forEach(
  3572. callbackfn: (value: number, index: number, array: Int32Array) => void,
  3573. thisArg?: any
  3574. ): void
  3575. /**
  3576. * Returns the index of the first occurrence of a value in an array.
  3577. * @param searchElement The value to locate in the array.
  3578. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
  3579. * search starts at index 0.
  3580. */
  3581. indexOf(searchElement: number, fromIndex?: number): number
  3582. /**
  3583. * Adds all the elements of an array separated by the specified separator string.
  3584. * @param separator A string used to separate one element of an array from the next in the
  3585. * resulting String. If omitted, the array elements are separated with a comma.
  3586. */
  3587. join(separator?: string): string
  3588. /**
  3589. * Returns the index of the last occurrence of a value in an array.
  3590. * @param searchElement The value to locate in the array.
  3591. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
  3592. * search starts at index 0.
  3593. */
  3594. lastIndexOf(searchElement: number, fromIndex?: number): number
  3595. /**
  3596. * The length of the array.
  3597. */
  3598. readonly length: number
  3599. /**
  3600. * Calls a defined callback function on each element of an array, and returns an array that
  3601. * contains the results.
  3602. * @param callbackfn A function that accepts up to three arguments. The map method calls the
  3603. * callbackfn function one time for each element in the array.
  3604. * @param thisArg An object to which the this keyword can refer in the callbackfn function.
  3605. * If thisArg is omitted, undefined is used as the this value.
  3606. */
  3607. map(
  3608. callbackfn: (value: number, index: number, array: Int32Array) => number,
  3609. thisArg?: any
  3610. ): Int32Array
  3611. /**
  3612. * Calls the specified callback function for all the elements in an array. The return value of
  3613. * the callback function is the accumulated result, and is provided as an argument in the next
  3614. * call to the callback function.
  3615. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the
  3616. * callbackfn function one time for each element in the array.
  3617. * @param initialValue If initialValue is specified, it is used as the initial value to start
  3618. * the accumulation. The first call to the callbackfn function provides this value as an argument
  3619. * instead of an array value.
  3620. */
  3621. reduce(
  3622. callbackfn: (
  3623. previousValue: number,
  3624. currentValue: number,
  3625. currentIndex: number,
  3626. array: Int32Array
  3627. ) => number
  3628. ): number
  3629. reduce(
  3630. callbackfn: (
  3631. previousValue: number,
  3632. currentValue: number,
  3633. currentIndex: number,
  3634. array: Int32Array
  3635. ) => number,
  3636. initialValue: number
  3637. ): number
  3638. /**
  3639. * Calls the specified callback function for all the elements in an array. The return value of
  3640. * the callback function is the accumulated result, and is provided as an argument in the next
  3641. * call to the callback function.
  3642. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the
  3643. * callbackfn function one time for each element in the array.
  3644. * @param initialValue If initialValue is specified, it is used as the initial value to start
  3645. * the accumulation. The first call to the callbackfn function provides this value as an argument
  3646. * instead of an array value.
  3647. */
  3648. reduce<U>(
  3649. callbackfn: (
  3650. previousValue: U,
  3651. currentValue: number,
  3652. currentIndex: number,
  3653. array: Int32Array
  3654. ) => U,
  3655. initialValue: U
  3656. ): U
  3657. /**
  3658. * Calls the specified callback function for all the elements in an array, in descending order.
  3659. * The return value of the callback function is the accumulated result, and is provided as an
  3660. * argument in the next call to the callback function.
  3661. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
  3662. * the callbackfn function one time for each element in the array.
  3663. * @param initialValue If initialValue is specified, it is used as the initial value to start
  3664. * the accumulation. The first call to the callbackfn function provides this value as an
  3665. * argument instead of an array value.
  3666. */
  3667. reduceRight(
  3668. callbackfn: (
  3669. previousValue: number,
  3670. currentValue: number,
  3671. currentIndex: number,
  3672. array: Int32Array
  3673. ) => number
  3674. ): number
  3675. reduceRight(
  3676. callbackfn: (
  3677. previousValue: number,
  3678. currentValue: number,
  3679. currentIndex: number,
  3680. array: Int32Array
  3681. ) => number,
  3682. initialValue: number
  3683. ): number
  3684. /**
  3685. * Calls the specified callback function for all the elements in an array, in descending order.
  3686. * The return value of the callback function is the accumulated result, and is provided as an
  3687. * argument in the next call to the callback function.
  3688. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
  3689. * the callbackfn function one time for each element in the array.
  3690. * @param initialValue If initialValue is specified, it is used as the initial value to start
  3691. * the accumulation. The first call to the callbackfn function provides this value as an argument
  3692. * instead of an array value.
  3693. */
  3694. reduceRight<U>(
  3695. callbackfn: (
  3696. previousValue: U,
  3697. currentValue: number,
  3698. currentIndex: number,
  3699. array: Int32Array
  3700. ) => U,
  3701. initialValue: U
  3702. ): U
  3703. /**
  3704. * Reverses the elements in an Array.
  3705. */
  3706. reverse(): Int32Array
  3707. /**
  3708. * Sets a value or an array of values.
  3709. * @param array A typed or untyped array of values to set.
  3710. * @param offset The index in the current array at which the values are to be written.
  3711. */
  3712. set(array: ArrayLike<number>, offset?: number): void
  3713. /**
  3714. * Returns a section of an array.
  3715. * @param start The beginning of the specified portion of the array.
  3716. * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'.
  3717. */
  3718. slice(start?: number, end?: number): Int32Array
  3719. /**
  3720. * Determines whether the specified callback function returns true for any element of an array.
  3721. * @param predicate A function that accepts up to three arguments. The some method calls
  3722. * the predicate function for each element in the array until the predicate returns a value
  3723. * which is coercible to the Boolean value true, or until the end of the array.
  3724. * @param thisArg An object to which the this keyword can refer in the predicate function.
  3725. * If thisArg is omitted, undefined is used as the this value.
  3726. */
  3727. some(
  3728. predicate: (value: number, index: number, array: Int32Array) => unknown,
  3729. thisArg?: any
  3730. ): boolean
  3731. /**
  3732. * Sorts an array.
  3733. * @param compareFn Function used to determine the order of the elements. It is expected to return
  3734. * a negative value if first argument is less than second argument, zero if they're equal and a positive
  3735. * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
  3736. * \`\`\`ts
  3737. * [11,2,22,1].sort((a, b) => a - b)
  3738. * \`\`\`
  3739. */
  3740. sort(compareFn?: (a: number, b: number) => number): this
  3741. /**
  3742. * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements
  3743. * at begin, inclusive, up to end, exclusive.
  3744. * @param begin The index of the beginning of the array.
  3745. * @param end The index of the end of the array.
  3746. */
  3747. subarray(begin?: number, end?: number): Int32Array
  3748. /**
  3749. * Converts a number to a string by using the current locale.
  3750. */
  3751. toLocaleString(): string
  3752. /**
  3753. * Returns a string representation of an array.
  3754. */
  3755. toString(): string
  3756. /** Returns the primitive value of the specified object. */
  3757. valueOf(): Int32Array
  3758. [index: number]: number
  3759. }
  3760. interface Int32ArrayConstructor {
  3761. readonly prototype: Int32Array
  3762. new (length: number): Int32Array
  3763. new (array: ArrayLike<number> | ArrayBufferLike): Int32Array
  3764. new (
  3765. buffer: ArrayBufferLike,
  3766. byteOffset?: number,
  3767. length?: number
  3768. ): Int32Array
  3769. /**
  3770. * The size in bytes of each element in the array.
  3771. */
  3772. readonly BYTES_PER_ELEMENT: number
  3773. /**
  3774. * Returns a new array from a set of elements.
  3775. * @param items A set of elements to include in the new array object.
  3776. */
  3777. of(...items: number[]): Int32Array
  3778. /**
  3779. * Creates an array from an array-like or iterable object.
  3780. * @param arrayLike An array-like or iterable object to convert to an array.
  3781. */
  3782. from(arrayLike: ArrayLike<number>): Int32Array
  3783. /**
  3784. * Creates an array from an array-like or iterable object.
  3785. * @param arrayLike An array-like or iterable object to convert to an array.
  3786. * @param mapfn A mapping function to call on every element of the array.
  3787. * @param thisArg Value of 'this' used to invoke the mapfn.
  3788. */
  3789. from<T>(
  3790. arrayLike: ArrayLike<T>,
  3791. mapfn: (v: T, k: number) => number,
  3792. thisArg?: any
  3793. ): Int32Array
  3794. }
  3795. declare var Int32Array: Int32ArrayConstructor
  3796. /**
  3797. * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the
  3798. * requested number of bytes could not be allocated an exception is raised.
  3799. */
  3800. interface Uint32Array {
  3801. /**
  3802. * The size in bytes of each element in the array.
  3803. */
  3804. readonly BYTES_PER_ELEMENT: number
  3805. /**
  3806. * The ArrayBuffer instance referenced by the array.
  3807. */
  3808. readonly buffer: ArrayBufferLike
  3809. /**
  3810. * The length in bytes of the array.
  3811. */
  3812. readonly byteLength: number
  3813. /**
  3814. * The offset in bytes of the array.
  3815. */
  3816. readonly byteOffset: number
  3817. /**
  3818. * Returns the this object after copying a section of the array identified by start and end
  3819. * to the same array starting at position target
  3820. * @param target If target is negative, it is treated as length+target where length is the
  3821. * length of the array.
  3822. * @param start If start is negative, it is treated as length+start. If end is negative, it
  3823. * is treated as length+end.
  3824. * @param end If not specified, length of the this object is used as its default value.
  3825. */
  3826. copyWithin(target: number, start: number, end?: number): this
  3827. /**
  3828. * Determines whether all the members of an array satisfy the specified test.
  3829. * @param predicate A function that accepts up to three arguments. The every method calls
  3830. * the predicate function for each element in the array until the predicate returns a value
  3831. * which is coercible to the Boolean value false, or until the end of the array.
  3832. * @param thisArg An object to which the this keyword can refer in the predicate function.
  3833. * If thisArg is omitted, undefined is used as the this value.
  3834. */
  3835. every(
  3836. predicate: (value: number, index: number, array: Uint32Array) => unknown,
  3837. thisArg?: any
  3838. ): boolean
  3839. /**
  3840. * Changes all array elements from \`start\` to \`end\` index to a static \`value\` and returns the modified array
  3841. * @param value value to fill array section with
  3842. * @param start index to start filling the array at. If start is negative, it is treated as
  3843. * length+start where length is the length of the array.
  3844. * @param end index to stop filling the array at. If end is negative, it is treated as
  3845. * length+end.
  3846. */
  3847. fill(value: number, start?: number, end?: number): this
  3848. /**
  3849. * Returns the elements of an array that meet the condition specified in a callback function.
  3850. * @param predicate A function that accepts up to three arguments. The filter method calls
  3851. * the predicate function one time for each element in the array.
  3852. * @param thisArg An object to which the this keyword can refer in the predicate function.
  3853. * If thisArg is omitted, undefined is used as the this value.
  3854. */
  3855. filter(
  3856. predicate: (value: number, index: number, array: Uint32Array) => any,
  3857. thisArg?: any
  3858. ): Uint32Array
  3859. /**
  3860. * Returns the value of the first element in the array where predicate is true, and undefined
  3861. * otherwise.
  3862. * @param predicate find calls predicate once for each element of the array, in ascending
  3863. * order, until it finds one where predicate returns true. If such an element is found, find
  3864. * immediately returns that element value. Otherwise, find returns undefined.
  3865. * @param thisArg If provided, it will be used as the this value for each invocation of
  3866. * predicate. If it is not provided, undefined is used instead.
  3867. */
  3868. find(
  3869. predicate: (value: number, index: number, obj: Uint32Array) => boolean,
  3870. thisArg?: any
  3871. ): number | undefined
  3872. /**
  3873. * Returns the index of the first element in the array where predicate is true, and -1
  3874. * otherwise.
  3875. * @param predicate find calls predicate once for each element of the array, in ascending
  3876. * order, until it finds one where predicate returns true. If such an element is found,
  3877. * findIndex immediately returns that element index. Otherwise, findIndex returns -1.
  3878. * @param thisArg If provided, it will be used as the this value for each invocation of
  3879. * predicate. If it is not provided, undefined is used instead.
  3880. */
  3881. findIndex(
  3882. predicate: (value: number, index: number, obj: Uint32Array) => boolean,
  3883. thisArg?: any
  3884. ): number
  3885. /**
  3886. * Performs the specified action for each element in an array.
  3887. * @param callbackfn A function that accepts up to three arguments. forEach calls the
  3888. * callbackfn function one time for each element in the array.
  3889. * @param thisArg An object to which the this keyword can refer in the callbackfn function.
  3890. * If thisArg is omitted, undefined is used as the this value.
  3891. */
  3892. forEach(
  3893. callbackfn: (value: number, index: number, array: Uint32Array) => void,
  3894. thisArg?: any
  3895. ): void
  3896. /**
  3897. * Returns the index of the first occurrence of a value in an array.
  3898. * @param searchElement The value to locate in the array.
  3899. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
  3900. * search starts at index 0.
  3901. */
  3902. indexOf(searchElement: number, fromIndex?: number): number
  3903. /**
  3904. * Adds all the elements of an array separated by the specified separator string.
  3905. * @param separator A string used to separate one element of an array from the next in the
  3906. * resulting String. If omitted, the array elements are separated with a comma.
  3907. */
  3908. join(separator?: string): string
  3909. /**
  3910. * Returns the index of the last occurrence of a value in an array.
  3911. * @param searchElement The value to locate in the array.
  3912. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
  3913. * search starts at index 0.
  3914. */
  3915. lastIndexOf(searchElement: number, fromIndex?: number): number
  3916. /**
  3917. * The length of the array.
  3918. */
  3919. readonly length: number
  3920. /**
  3921. * Calls a defined callback function on each element of an array, and returns an array that
  3922. * contains the results.
  3923. * @param callbackfn A function that accepts up to three arguments. The map method calls the
  3924. * callbackfn function one time for each element in the array.
  3925. * @param thisArg An object to which the this keyword can refer in the callbackfn function.
  3926. * If thisArg is omitted, undefined is used as the this value.
  3927. */
  3928. map(
  3929. callbackfn: (value: number, index: number, array: Uint32Array) => number,
  3930. thisArg?: any
  3931. ): Uint32Array
  3932. /**
  3933. * Calls the specified callback function for all the elements in an array. The return value of
  3934. * the callback function is the accumulated result, and is provided as an argument in the next
  3935. * call to the callback function.
  3936. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the
  3937. * callbackfn function one time for each element in the array.
  3938. * @param initialValue If initialValue is specified, it is used as the initial value to start
  3939. * the accumulation. The first call to the callbackfn function provides this value as an argument
  3940. * instead of an array value.
  3941. */
  3942. reduce(
  3943. callbackfn: (
  3944. previousValue: number,
  3945. currentValue: number,
  3946. currentIndex: number,
  3947. array: Uint32Array
  3948. ) => number
  3949. ): number
  3950. reduce(
  3951. callbackfn: (
  3952. previousValue: number,
  3953. currentValue: number,
  3954. currentIndex: number,
  3955. array: Uint32Array
  3956. ) => number,
  3957. initialValue: number
  3958. ): number
  3959. /**
  3960. * Calls the specified callback function for all the elements in an array. The return value of
  3961. * the callback function is the accumulated result, and is provided as an argument in the next
  3962. * call to the callback function.
  3963. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the
  3964. * callbackfn function one time for each element in the array.
  3965. * @param initialValue If initialValue is specified, it is used as the initial value to start
  3966. * the accumulation. The first call to the callbackfn function provides this value as an argument
  3967. * instead of an array value.
  3968. */
  3969. reduce<U>(
  3970. callbackfn: (
  3971. previousValue: U,
  3972. currentValue: number,
  3973. currentIndex: number,
  3974. array: Uint32Array
  3975. ) => U,
  3976. initialValue: U
  3977. ): U
  3978. /**
  3979. * Calls the specified callback function for all the elements in an array, in descending order.
  3980. * The return value of the callback function is the accumulated result, and is provided as an
  3981. * argument in the next call to the callback function.
  3982. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
  3983. * the callbackfn function one time for each element in the array.
  3984. * @param initialValue If initialValue is specified, it is used as the initial value to start
  3985. * the accumulation. The first call to the callbackfn function provides this value as an
  3986. * argument instead of an array value.
  3987. */
  3988. reduceRight(
  3989. callbackfn: (
  3990. previousValue: number,
  3991. currentValue: number,
  3992. currentIndex: number,
  3993. array: Uint32Array
  3994. ) => number
  3995. ): number
  3996. reduceRight(
  3997. callbackfn: (
  3998. previousValue: number,
  3999. currentValue: number,
  4000. currentIndex: number,
  4001. array: Uint32Array
  4002. ) => number,
  4003. initialValue: number
  4004. ): number
  4005. /**
  4006. * Calls the specified callback function for all the elements in an array, in descending order.
  4007. * The return value of the callback function is the accumulated result, and is provided as an
  4008. * argument in the next call to the callback function.
  4009. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
  4010. * the callbackfn function one time for each element in the array.
  4011. * @param initialValue If initialValue is specified, it is used as the initial value to start
  4012. * the accumulation. The first call to the callbackfn function provides this value as an argument
  4013. * instead of an array value.
  4014. */
  4015. reduceRight<U>(
  4016. callbackfn: (
  4017. previousValue: U,
  4018. currentValue: number,
  4019. currentIndex: number,
  4020. array: Uint32Array
  4021. ) => U,
  4022. initialValue: U
  4023. ): U
  4024. /**
  4025. * Reverses the elements in an Array.
  4026. */
  4027. reverse(): Uint32Array
  4028. /**
  4029. * Sets a value or an array of values.
  4030. * @param array A typed or untyped array of values to set.
  4031. * @param offset The index in the current array at which the values are to be written.
  4032. */
  4033. set(array: ArrayLike<number>, offset?: number): void
  4034. /**
  4035. * Returns a section of an array.
  4036. * @param start The beginning of the specified portion of the array.
  4037. * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'.
  4038. */
  4039. slice(start?: number, end?: number): Uint32Array
  4040. /**
  4041. * Determines whether the specified callback function returns true for any element of an array.
  4042. * @param predicate A function that accepts up to three arguments. The some method calls
  4043. * the predicate function for each element in the array until the predicate returns a value
  4044. * which is coercible to the Boolean value true, or until the end of the array.
  4045. * @param thisArg An object to which the this keyword can refer in the predicate function.
  4046. * If thisArg is omitted, undefined is used as the this value.
  4047. */
  4048. some(
  4049. predicate: (value: number, index: number, array: Uint32Array) => unknown,
  4050. thisArg?: any
  4051. ): boolean
  4052. /**
  4053. * Sorts an array.
  4054. * @param compareFn Function used to determine the order of the elements. It is expected to return
  4055. * a negative value if first argument is less than second argument, zero if they're equal and a positive
  4056. * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
  4057. * \`\`\`ts
  4058. * [11,2,22,1].sort((a, b) => a - b)
  4059. * \`\`\`
  4060. */
  4061. sort(compareFn?: (a: number, b: number) => number): this
  4062. /**
  4063. * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements
  4064. * at begin, inclusive, up to end, exclusive.
  4065. * @param begin The index of the beginning of the array.
  4066. * @param end The index of the end of the array.
  4067. */
  4068. subarray(begin?: number, end?: number): Uint32Array
  4069. /**
  4070. * Converts a number to a string by using the current locale.
  4071. */
  4072. toLocaleString(): string
  4073. /**
  4074. * Returns a string representation of an array.
  4075. */
  4076. toString(): string
  4077. /** Returns the primitive value of the specified object. */
  4078. valueOf(): Uint32Array
  4079. [index: number]: number
  4080. }
  4081. interface Uint32ArrayConstructor {
  4082. readonly prototype: Uint32Array
  4083. new (length: number): Uint32Array
  4084. new (array: ArrayLike<number> | ArrayBufferLike): Uint32Array
  4085. new (
  4086. buffer: ArrayBufferLike,
  4087. byteOffset?: number,
  4088. length?: number
  4089. ): Uint32Array
  4090. /**
  4091. * The size in bytes of each element in the array.
  4092. */
  4093. readonly BYTES_PER_ELEMENT: number
  4094. /**
  4095. * Returns a new array from a set of elements.
  4096. * @param items A set of elements to include in the new array object.
  4097. */
  4098. of(...items: number[]): Uint32Array
  4099. /**
  4100. * Creates an array from an array-like or iterable object.
  4101. * @param arrayLike An array-like or iterable object to convert to an array.
  4102. */
  4103. from(arrayLike: ArrayLike<number>): Uint32Array
  4104. /**
  4105. * Creates an array from an array-like or iterable object.
  4106. * @param arrayLike An array-like or iterable object to convert to an array.
  4107. * @param mapfn A mapping function to call on every element of the array.
  4108. * @param thisArg Value of 'this' used to invoke the mapfn.
  4109. */
  4110. from<T>(
  4111. arrayLike: ArrayLike<T>,
  4112. mapfn: (v: T, k: number) => number,
  4113. thisArg?: any
  4114. ): Uint32Array
  4115. }
  4116. declare var Uint32Array: Uint32ArrayConstructor
  4117. /**
  4118. * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number
  4119. * of bytes could not be allocated an exception is raised.
  4120. */
  4121. interface Float32Array {
  4122. /**
  4123. * The size in bytes of each element in the array.
  4124. */
  4125. readonly BYTES_PER_ELEMENT: number
  4126. /**
  4127. * The ArrayBuffer instance referenced by the array.
  4128. */
  4129. readonly buffer: ArrayBufferLike
  4130. /**
  4131. * The length in bytes of the array.
  4132. */
  4133. readonly byteLength: number
  4134. /**
  4135. * The offset in bytes of the array.
  4136. */
  4137. readonly byteOffset: number
  4138. /**
  4139. * Returns the this object after copying a section of the array identified by start and end
  4140. * to the same array starting at position target
  4141. * @param target If target is negative, it is treated as length+target where length is the
  4142. * length of the array.
  4143. * @param start If start is negative, it is treated as length+start. If end is negative, it
  4144. * is treated as length+end.
  4145. * @param end If not specified, length of the this object is used as its default value.
  4146. */
  4147. copyWithin(target: number, start: number, end?: number): this
  4148. /**
  4149. * Determines whether all the members of an array satisfy the specified test.
  4150. * @param predicate A function that accepts up to three arguments. The every method calls
  4151. * the predicate function for each element in the array until the predicate returns a value
  4152. * which is coercible to the Boolean value false, or until the end of the array.
  4153. * @param thisArg An object to which the this keyword can refer in the predicate function.
  4154. * If thisArg is omitted, undefined is used as the this value.
  4155. */
  4156. every(
  4157. predicate: (value: number, index: number, array: Float32Array) => unknown,
  4158. thisArg?: any
  4159. ): boolean
  4160. /**
  4161. * Changes all array elements from \`start\` to \`end\` index to a static \`value\` and returns the modified array
  4162. * @param value value to fill array section with
  4163. * @param start index to start filling the array at. If start is negative, it is treated as
  4164. * length+start where length is the length of the array.
  4165. * @param end index to stop filling the array at. If end is negative, it is treated as
  4166. * length+end.
  4167. */
  4168. fill(value: number, start?: number, end?: number): this
  4169. /**
  4170. * Returns the elements of an array that meet the condition specified in a callback function.
  4171. * @param predicate A function that accepts up to three arguments. The filter method calls
  4172. * the predicate function one time for each element in the array.
  4173. * @param thisArg An object to which the this keyword can refer in the predicate function.
  4174. * If thisArg is omitted, undefined is used as the this value.
  4175. */
  4176. filter(
  4177. predicate: (value: number, index: number, array: Float32Array) => any,
  4178. thisArg?: any
  4179. ): Float32Array
  4180. /**
  4181. * Returns the value of the first element in the array where predicate is true, and undefined
  4182. * otherwise.
  4183. * @param predicate find calls predicate once for each element of the array, in ascending
  4184. * order, until it finds one where predicate returns true. If such an element is found, find
  4185. * immediately returns that element value. Otherwise, find returns undefined.
  4186. * @param thisArg If provided, it will be used as the this value for each invocation of
  4187. * predicate. If it is not provided, undefined is used instead.
  4188. */
  4189. find(
  4190. predicate: (value: number, index: number, obj: Float32Array) => boolean,
  4191. thisArg?: any
  4192. ): number | undefined
  4193. /**
  4194. * Returns the index of the first element in the array where predicate is true, and -1
  4195. * otherwise.
  4196. * @param predicate find calls predicate once for each element of the array, in ascending
  4197. * order, until it finds one where predicate returns true. If such an element is found,
  4198. * findIndex immediately returns that element index. Otherwise, findIndex returns -1.
  4199. * @param thisArg If provided, it will be used as the this value for each invocation of
  4200. * predicate. If it is not provided, undefined is used instead.
  4201. */
  4202. findIndex(
  4203. predicate: (value: number, index: number, obj: Float32Array) => boolean,
  4204. thisArg?: any
  4205. ): number
  4206. /**
  4207. * Performs the specified action for each element in an array.
  4208. * @param callbackfn A function that accepts up to three arguments. forEach calls the
  4209. * callbackfn function one time for each element in the array.
  4210. * @param thisArg An object to which the this keyword can refer in the callbackfn function.
  4211. * If thisArg is omitted, undefined is used as the this value.
  4212. */
  4213. forEach(
  4214. callbackfn: (value: number, index: number, array: Float32Array) => void,
  4215. thisArg?: any
  4216. ): void
  4217. /**
  4218. * Returns the index of the first occurrence of a value in an array.
  4219. * @param searchElement The value to locate in the array.
  4220. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
  4221. * search starts at index 0.
  4222. */
  4223. indexOf(searchElement: number, fromIndex?: number): number
  4224. /**
  4225. * Adds all the elements of an array separated by the specified separator string.
  4226. * @param separator A string used to separate one element of an array from the next in the
  4227. * resulting String. If omitted, the array elements are separated with a comma.
  4228. */
  4229. join(separator?: string): string
  4230. /**
  4231. * Returns the index of the last occurrence of a value in an array.
  4232. * @param searchElement The value to locate in the array.
  4233. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
  4234. * search starts at index 0.
  4235. */
  4236. lastIndexOf(searchElement: number, fromIndex?: number): number
  4237. /**
  4238. * The length of the array.
  4239. */
  4240. readonly length: number
  4241. /**
  4242. * Calls a defined callback function on each element of an array, and returns an array that
  4243. * contains the results.
  4244. * @param callbackfn A function that accepts up to three arguments. The map method calls the
  4245. * callbackfn function one time for each element in the array.
  4246. * @param thisArg An object to which the this keyword can refer in the callbackfn function.
  4247. * If thisArg is omitted, undefined is used as the this value.
  4248. */
  4249. map(
  4250. callbackfn: (value: number, index: number, array: Float32Array) => number,
  4251. thisArg?: any
  4252. ): Float32Array
  4253. /**
  4254. * Calls the specified callback function for all the elements in an array. The return value of
  4255. * the callback function is the accumulated result, and is provided as an argument in the next
  4256. * call to the callback function.
  4257. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the
  4258. * callbackfn function one time for each element in the array.
  4259. * @param initialValue If initialValue is specified, it is used as the initial value to start
  4260. * the accumulation. The first call to the callbackfn function provides this value as an argument
  4261. * instead of an array value.
  4262. */
  4263. reduce(
  4264. callbackfn: (
  4265. previousValue: number,
  4266. currentValue: number,
  4267. currentIndex: number,
  4268. array: Float32Array
  4269. ) => number
  4270. ): number
  4271. reduce(
  4272. callbackfn: (
  4273. previousValue: number,
  4274. currentValue: number,
  4275. currentIndex: number,
  4276. array: Float32Array
  4277. ) => number,
  4278. initialValue: number
  4279. ): number
  4280. /**
  4281. * Calls the specified callback function for all the elements in an array. The return value of
  4282. * the callback function is the accumulated result, and is provided as an argument in the next
  4283. * call to the callback function.
  4284. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the
  4285. * callbackfn function one time for each element in the array.
  4286. * @param initialValue If initialValue is specified, it is used as the initial value to start
  4287. * the accumulation. The first call to the callbackfn function provides this value as an argument
  4288. * instead of an array value.
  4289. */
  4290. reduce<U>(
  4291. callbackfn: (
  4292. previousValue: U,
  4293. currentValue: number,
  4294. currentIndex: number,
  4295. array: Float32Array
  4296. ) => U,
  4297. initialValue: U
  4298. ): U
  4299. /**
  4300. * Calls the specified callback function for all the elements in an array, in descending order.
  4301. * The return value of the callback function is the accumulated result, and is provided as an
  4302. * argument in the next call to the callback function.
  4303. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
  4304. * the callbackfn function one time for each element in the array.
  4305. * @param initialValue If initialValue is specified, it is used as the initial value to start
  4306. * the accumulation. The first call to the callbackfn function provides this value as an
  4307. * argument instead of an array value.
  4308. */
  4309. reduceRight(
  4310. callbackfn: (
  4311. previousValue: number,
  4312. currentValue: number,
  4313. currentIndex: number,
  4314. array: Float32Array
  4315. ) => number
  4316. ): number
  4317. reduceRight(
  4318. callbackfn: (
  4319. previousValue: number,
  4320. currentValue: number,
  4321. currentIndex: number,
  4322. array: Float32Array
  4323. ) => number,
  4324. initialValue: number
  4325. ): number
  4326. /**
  4327. * Calls the specified callback function for all the elements in an array, in descending order.
  4328. * The return value of the callback function is the accumulated result, and is provided as an
  4329. * argument in the next call to the callback function.
  4330. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
  4331. * the callbackfn function one time for each element in the array.
  4332. * @param initialValue If initialValue is specified, it is used as the initial value to start
  4333. * the accumulation. The first call to the callbackfn function provides this value as an argument
  4334. * instead of an array value.
  4335. */
  4336. reduceRight<U>(
  4337. callbackfn: (
  4338. previousValue: U,
  4339. currentValue: number,
  4340. currentIndex: number,
  4341. array: Float32Array
  4342. ) => U,
  4343. initialValue: U
  4344. ): U
  4345. /**
  4346. * Reverses the elements in an Array.
  4347. */
  4348. reverse(): Float32Array
  4349. /**
  4350. * Sets a value or an array of values.
  4351. * @param array A typed or untyped array of values to set.
  4352. * @param offset The index in the current array at which the values are to be written.
  4353. */
  4354. set(array: ArrayLike<number>, offset?: number): void
  4355. /**
  4356. * Returns a section of an array.
  4357. * @param start The beginning of the specified portion of the array.
  4358. * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'.
  4359. */
  4360. slice(start?: number, end?: number): Float32Array
  4361. /**
  4362. * Determines whether the specified callback function returns true for any element of an array.
  4363. * @param predicate A function that accepts up to three arguments. The some method calls
  4364. * the predicate function for each element in the array until the predicate returns a value
  4365. * which is coercible to the Boolean value true, or until the end of the array.
  4366. * @param thisArg An object to which the this keyword can refer in the predicate function.
  4367. * If thisArg is omitted, undefined is used as the this value.
  4368. */
  4369. some(
  4370. predicate: (value: number, index: number, array: Float32Array) => unknown,
  4371. thisArg?: any
  4372. ): boolean
  4373. /**
  4374. * Sorts an array.
  4375. * @param compareFn Function used to determine the order of the elements. It is expected to return
  4376. * a negative value if first argument is less than second argument, zero if they're equal and a positive
  4377. * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
  4378. * \`\`\`ts
  4379. * [11,2,22,1].sort((a, b) => a - b)
  4380. * \`\`\`
  4381. */
  4382. sort(compareFn?: (a: number, b: number) => number): this
  4383. /**
  4384. * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements
  4385. * at begin, inclusive, up to end, exclusive.
  4386. * @param begin The index of the beginning of the array.
  4387. * @param end The index of the end of the array.
  4388. */
  4389. subarray(begin?: number, end?: number): Float32Array
  4390. /**
  4391. * Converts a number to a string by using the current locale.
  4392. */
  4393. toLocaleString(): string
  4394. /**
  4395. * Returns a string representation of an array.
  4396. */
  4397. toString(): string
  4398. /** Returns the primitive value of the specified object. */
  4399. valueOf(): Float32Array
  4400. [index: number]: number
  4401. }
  4402. interface Float32ArrayConstructor {
  4403. readonly prototype: Float32Array
  4404. new (length: number): Float32Array
  4405. new (array: ArrayLike<number> | ArrayBufferLike): Float32Array
  4406. new (
  4407. buffer: ArrayBufferLike,
  4408. byteOffset?: number,
  4409. length?: number
  4410. ): Float32Array
  4411. /**
  4412. * The size in bytes of each element in the array.
  4413. */
  4414. readonly BYTES_PER_ELEMENT: number
  4415. /**
  4416. * Returns a new array from a set of elements.
  4417. * @param items A set of elements to include in the new array object.
  4418. */
  4419. of(...items: number[]): Float32Array
  4420. /**
  4421. * Creates an array from an array-like or iterable object.
  4422. * @param arrayLike An array-like or iterable object to convert to an array.
  4423. */
  4424. from(arrayLike: ArrayLike<number>): Float32Array
  4425. /**
  4426. * Creates an array from an array-like or iterable object.
  4427. * @param arrayLike An array-like or iterable object to convert to an array.
  4428. * @param mapfn A mapping function to call on every element of the array.
  4429. * @param thisArg Value of 'this' used to invoke the mapfn.
  4430. */
  4431. from<T>(
  4432. arrayLike: ArrayLike<T>,
  4433. mapfn: (v: T, k: number) => number,
  4434. thisArg?: any
  4435. ): Float32Array
  4436. }
  4437. declare var Float32Array: Float32ArrayConstructor
  4438. /**
  4439. * A typed array of 64-bit float values. The contents are initialized to 0. If the requested
  4440. * number of bytes could not be allocated an exception is raised.
  4441. */
  4442. interface Float64Array {
  4443. /**
  4444. * The size in bytes of each element in the array.
  4445. */
  4446. readonly BYTES_PER_ELEMENT: number
  4447. /**
  4448. * The ArrayBuffer instance referenced by the array.
  4449. */
  4450. readonly buffer: ArrayBufferLike
  4451. /**
  4452. * The length in bytes of the array.
  4453. */
  4454. readonly byteLength: number
  4455. /**
  4456. * The offset in bytes of the array.
  4457. */
  4458. readonly byteOffset: number
  4459. /**
  4460. * Returns the this object after copying a section of the array identified by start and end
  4461. * to the same array starting at position target
  4462. * @param target If target is negative, it is treated as length+target where length is the
  4463. * length of the array.
  4464. * @param start If start is negative, it is treated as length+start. If end is negative, it
  4465. * is treated as length+end.
  4466. * @param end If not specified, length of the this object is used as its default value.
  4467. */
  4468. copyWithin(target: number, start: number, end?: number): this
  4469. /**
  4470. * Determines whether all the members of an array satisfy the specified test.
  4471. * @param predicate A function that accepts up to three arguments. The every method calls
  4472. * the predicate function for each element in the array until the predicate returns a value
  4473. * which is coercible to the Boolean value false, or until the end of the array.
  4474. * @param thisArg An object to which the this keyword can refer in the predicate function.
  4475. * If thisArg is omitted, undefined is used as the this value.
  4476. */
  4477. every(
  4478. predicate: (value: number, index: number, array: Float64Array) => unknown,
  4479. thisArg?: any
  4480. ): boolean
  4481. /**
  4482. * Changes all array elements from \`start\` to \`end\` index to a static \`value\` and returns the modified array
  4483. * @param value value to fill array section with
  4484. * @param start index to start filling the array at. If start is negative, it is treated as
  4485. * length+start where length is the length of the array.
  4486. * @param end index to stop filling the array at. If end is negative, it is treated as
  4487. * length+end.
  4488. */
  4489. fill(value: number, start?: number, end?: number): this
  4490. /**
  4491. * Returns the elements of an array that meet the condition specified in a callback function.
  4492. * @param predicate A function that accepts up to three arguments. The filter method calls
  4493. * the predicate function one time for each element in the array.
  4494. * @param thisArg An object to which the this keyword can refer in the predicate function.
  4495. * If thisArg is omitted, undefined is used as the this value.
  4496. */
  4497. filter(
  4498. predicate: (value: number, index: number, array: Float64Array) => any,
  4499. thisArg?: any
  4500. ): Float64Array
  4501. /**
  4502. * Returns the value of the first element in the array where predicate is true, and undefined
  4503. * otherwise.
  4504. * @param predicate find calls predicate once for each element of the array, in ascending
  4505. * order, until it finds one where predicate returns true. If such an element is found, find
  4506. * immediately returns that element value. Otherwise, find returns undefined.
  4507. * @param thisArg If provided, it will be used as the this value for each invocation of
  4508. * predicate. If it is not provided, undefined is used instead.
  4509. */
  4510. find(
  4511. predicate: (value: number, index: number, obj: Float64Array) => boolean,
  4512. thisArg?: any
  4513. ): number | undefined
  4514. /**
  4515. * Returns the index of the first element in the array where predicate is true, and -1
  4516. * otherwise.
  4517. * @param predicate find calls predicate once for each element of the array, in ascending
  4518. * order, until it finds one where predicate returns true. If such an element is found,
  4519. * findIndex immediately returns that element index. Otherwise, findIndex returns -1.
  4520. * @param thisArg If provided, it will be used as the this value for each invocation of
  4521. * predicate. If it is not provided, undefined is used instead.
  4522. */
  4523. findIndex(
  4524. predicate: (value: number, index: number, obj: Float64Array) => boolean,
  4525. thisArg?: any
  4526. ): number
  4527. /**
  4528. * Performs the specified action for each element in an array.
  4529. * @param callbackfn A function that accepts up to three arguments. forEach calls the
  4530. * callbackfn function one time for each element in the array.
  4531. * @param thisArg An object to which the this keyword can refer in the callbackfn function.
  4532. * If thisArg is omitted, undefined is used as the this value.
  4533. */
  4534. forEach(
  4535. callbackfn: (value: number, index: number, array: Float64Array) => void,
  4536. thisArg?: any
  4537. ): void
  4538. /**
  4539. * Returns the index of the first occurrence of a value in an array.
  4540. * @param searchElement The value to locate in the array.
  4541. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
  4542. * search starts at index 0.
  4543. */
  4544. indexOf(searchElement: number, fromIndex?: number): number
  4545. /**
  4546. * Adds all the elements of an array separated by the specified separator string.
  4547. * @param separator A string used to separate one element of an array from the next in the
  4548. * resulting String. If omitted, the array elements are separated with a comma.
  4549. */
  4550. join(separator?: string): string
  4551. /**
  4552. * Returns the index of the last occurrence of a value in an array.
  4553. * @param searchElement The value to locate in the array.
  4554. * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the
  4555. * search starts at index 0.
  4556. */
  4557. lastIndexOf(searchElement: number, fromIndex?: number): number
  4558. /**
  4559. * The length of the array.
  4560. */
  4561. readonly length: number
  4562. /**
  4563. * Calls a defined callback function on each element of an array, and returns an array that
  4564. * contains the results.
  4565. * @param callbackfn A function that accepts up to three arguments. The map method calls the
  4566. * callbackfn function one time for each element in the array.
  4567. * @param thisArg An object to which the this keyword can refer in the callbackfn function.
  4568. * If thisArg is omitted, undefined is used as the this value.
  4569. */
  4570. map(
  4571. callbackfn: (value: number, index: number, array: Float64Array) => number,
  4572. thisArg?: any
  4573. ): Float64Array
  4574. /**
  4575. * Calls the specified callback function for all the elements in an array. The return value of
  4576. * the callback function is the accumulated result, and is provided as an argument in the next
  4577. * call to the callback function.
  4578. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the
  4579. * callbackfn function one time for each element in the array.
  4580. * @param initialValue If initialValue is specified, it is used as the initial value to start
  4581. * the accumulation. The first call to the callbackfn function provides this value as an argument
  4582. * instead of an array value.
  4583. */
  4584. reduce(
  4585. callbackfn: (
  4586. previousValue: number,
  4587. currentValue: number,
  4588. currentIndex: number,
  4589. array: Float64Array
  4590. ) => number
  4591. ): number
  4592. reduce(
  4593. callbackfn: (
  4594. previousValue: number,
  4595. currentValue: number,
  4596. currentIndex: number,
  4597. array: Float64Array
  4598. ) => number,
  4599. initialValue: number
  4600. ): number
  4601. /**
  4602. * Calls the specified callback function for all the elements in an array. The return value of
  4603. * the callback function is the accumulated result, and is provided as an argument in the next
  4604. * call to the callback function.
  4605. * @param callbackfn A function that accepts up to four arguments. The reduce method calls the
  4606. * callbackfn function one time for each element in the array.
  4607. * @param initialValue If initialValue is specified, it is used as the initial value to start
  4608. * the accumulation. The first call to the callbackfn function provides this value as an argument
  4609. * instead of an array value.
  4610. */
  4611. reduce<U>(
  4612. callbackfn: (
  4613. previousValue: U,
  4614. currentValue: number,
  4615. currentIndex: number,
  4616. array: Float64Array
  4617. ) => U,
  4618. initialValue: U
  4619. ): U
  4620. /**
  4621. * Calls the specified callback function for all the elements in an array, in descending order.
  4622. * The return value of the callback function is the accumulated result, and is provided as an
  4623. * argument in the next call to the callback function.
  4624. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
  4625. * the callbackfn function one time for each element in the array.
  4626. * @param initialValue If initialValue is specified, it is used as the initial value to start
  4627. * the accumulation. The first call to the callbackfn function provides this value as an
  4628. * argument instead of an array value.
  4629. */
  4630. reduceRight(
  4631. callbackfn: (
  4632. previousValue: number,
  4633. currentValue: number,
  4634. currentIndex: number,
  4635. array: Float64Array
  4636. ) => number
  4637. ): number
  4638. reduceRight(
  4639. callbackfn: (
  4640. previousValue: number,
  4641. currentValue: number,
  4642. currentIndex: number,
  4643. array: Float64Array
  4644. ) => number,
  4645. initialValue: number
  4646. ): number
  4647. /**
  4648. * Calls the specified callback function for all the elements in an array, in descending order.
  4649. * The return value of the callback function is the accumulated result, and is provided as an
  4650. * argument in the next call to the callback function.
  4651. * @param callbackfn A function that accepts up to four arguments. The reduceRight method calls
  4652. * the callbackfn function one time for each element in the array.
  4653. * @param initialValue If initialValue is specified, it is used as the initial value to start
  4654. * the accumulation. The first call to the callbackfn function provides this value as an argument
  4655. * instead of an array value.
  4656. */
  4657. reduceRight<U>(
  4658. callbackfn: (
  4659. previousValue: U,
  4660. currentValue: number,
  4661. currentIndex: number,
  4662. array: Float64Array
  4663. ) => U,
  4664. initialValue: U
  4665. ): U
  4666. /**
  4667. * Reverses the elements in an Array.
  4668. */
  4669. reverse(): Float64Array
  4670. /**
  4671. * Sets a value or an array of values.
  4672. * @param array A typed or untyped array of values to set.
  4673. * @param offset The index in the current array at which the values are to be written.
  4674. */
  4675. set(array: ArrayLike<number>, offset?: number): void
  4676. /**
  4677. * Returns a section of an array.
  4678. * @param start The beginning of the specified portion of the array.
  4679. * @param end The end of the specified portion of the array. This is exclusive of the element at the index 'end'.
  4680. */
  4681. slice(start?: number, end?: number): Float64Array
  4682. /**
  4683. * Determines whether the specified callback function returns true for any element of an array.
  4684. * @param predicate A function that accepts up to three arguments. The some method calls
  4685. * the predicate function for each element in the array until the predicate returns a value
  4686. * which is coercible to the Boolean value true, or until the end of the array.
  4687. * @param thisArg An object to which the this keyword can refer in the predicate function.
  4688. * If thisArg is omitted, undefined is used as the this value.
  4689. */
  4690. some(
  4691. predicate: (value: number, index: number, array: Float64Array) => unknown,
  4692. thisArg?: any
  4693. ): boolean
  4694. /**
  4695. * Sorts an array.
  4696. * @param compareFn Function used to determine the order of the elements. It is expected to return
  4697. * a negative value if first argument is less than second argument, zero if they're equal and a positive
  4698. * value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.
  4699. * \`\`\`ts
  4700. * [11,2,22,1].sort((a, b) => a - b)
  4701. * \`\`\`
  4702. */
  4703. sort(compareFn?: (a: number, b: number) => number): this
  4704. /**
  4705. * at begin, inclusive, up to end, exclusive.
  4706. * @param begin The index of the beginning of the array.
  4707. * @param end The index of the end of the array.
  4708. */
  4709. subarray(begin?: number, end?: number): Float64Array
  4710. toString(): string
  4711. /** Returns the primitive value of the specified object. */
  4712. valueOf(): Float64Array
  4713. [index: number]: number
  4714. }
  4715. interface Float64ArrayConstructor {
  4716. readonly prototype: Float64Array
  4717. new (length: number): Float64Array
  4718. new (array: ArrayLike<number> | ArrayBufferLike): Float64Array
  4719. new (
  4720. buffer: ArrayBufferLike,
  4721. byteOffset?: number,
  4722. length?: number
  4723. ): Float64Array
  4724. /**
  4725. * The size in bytes of each element in the array.
  4726. */
  4727. readonly BYTES_PER_ELEMENT: number
  4728. /**
  4729. * Returns a new array from a set of elements.
  4730. * @param items A set of elements to include in the new array object.
  4731. */
  4732. of(...items: number[]): Float64Array
  4733. /**
  4734. * Creates an array from an array-like or iterable object.
  4735. * @param arrayLike An array-like or iterable object to convert to an array.
  4736. */
  4737. from(arrayLike: ArrayLike<number>): Float64Array
  4738. /**
  4739. * Creates an array from an array-like or iterable object.
  4740. * @param arrayLike An array-like or iterable object to convert to an array.
  4741. * @param mapfn A mapping function to call on every element of the array.
  4742. * @param thisArg Value of 'this' used to invoke the mapfn.
  4743. */
  4744. from<T>(
  4745. arrayLike: ArrayLike<T>,
  4746. mapfn: (v: T, k: number) => number,
  4747. thisArg?: any
  4748. ): Float64Array
  4749. }
  4750. declare var Float64Array: Float64ArrayConstructor
  4751. /////////////////////////////
  4752. /// ECMAScript Internationalization API
  4753. /////////////////////////////
  4754. declare namespace Intl {
  4755. interface CollatorOptions {
  4756. usage?: string
  4757. localeMatcher?: string
  4758. numeric?: boolean
  4759. caseFirst?: string
  4760. sensitivity?: string
  4761. ignorePunctuation?: boolean
  4762. }
  4763. interface ResolvedCollatorOptions {
  4764. locale: string
  4765. usage: string
  4766. sensitivity: string
  4767. ignorePunctuation: boolean
  4768. collation: string
  4769. caseFirst: string
  4770. numeric: boolean
  4771. }
  4772. interface Collator {
  4773. compare(x: string, y: string): number
  4774. resolvedOptions(): ResolvedCollatorOptions
  4775. }
  4776. var Collator: {
  4777. new (locales?: string | string[], options?: CollatorOptions): Collator
  4778. (locales?: string | string[], options?: CollatorOptions): Collator
  4779. supportedLocalesOf(
  4780. locales: string | string[],
  4781. options?: CollatorOptions
  4782. ): string[]
  4783. }
  4784. interface NumberFormatOptions {
  4785. localeMatcher?: string
  4786. style?: string
  4787. currency?: string
  4788. currencyDisplay?: string
  4789. currencySign?: string
  4790. useGrouping?: boolean
  4791. minimumIntegerDigits?: number
  4792. minimumFractionDigits?: number
  4793. maximumFractionDigits?: number
  4794. minimumSignificantDigits?: number
  4795. maximumSignificantDigits?: number
  4796. }
  4797. interface ResolvedNumberFormatOptions {
  4798. locale: string
  4799. numberingSystem: string
  4800. style: string
  4801. currency?: string
  4802. currencyDisplay?: string
  4803. minimumIntegerDigits: number
  4804. minimumFractionDigits: number
  4805. maximumFractionDigits: number
  4806. minimumSignificantDigits?: number
  4807. maximumSignificantDigits?: number
  4808. useGrouping: boolean
  4809. }
  4810. interface NumberFormat {
  4811. format(value: number): string
  4812. resolvedOptions(): ResolvedNumberFormatOptions
  4813. }
  4814. var NumberFormat: {
  4815. new (
  4816. locales?: string | string[],
  4817. options?: NumberFormatOptions
  4818. ): NumberFormat
  4819. (locales?: string | string[], options?: NumberFormatOptions): NumberFormat
  4820. supportedLocalesOf(
  4821. locales: string | string[],
  4822. options?: NumberFormatOptions
  4823. ): string[]
  4824. }
  4825. interface DateTimeFormatOptions {
  4826. localeMatcher?: 'best fit' | 'lookup'
  4827. weekday?: 'long' | 'short' | 'narrow'
  4828. era?: 'long' | 'short' | 'narrow'
  4829. year?: 'numeric' | '2-digit'
  4830. month?: 'numeric' | '2-digit' | 'long' | 'short' | 'narrow'
  4831. day?: 'numeric' | '2-digit'
  4832. hour?: 'numeric' | '2-digit'
  4833. minute?: 'numeric' | '2-digit'
  4834. second?: 'numeric' | '2-digit'
  4835. timeZoneName?: 'long' | 'short'
  4836. formatMatcher?: 'best fit' | 'basic'
  4837. hour12?: boolean
  4838. timeZone?: string
  4839. }
  4840. interface ResolvedDateTimeFormatOptions {
  4841. locale: string
  4842. calendar: string
  4843. numberingSystem: string
  4844. timeZone: string
  4845. hour12?: boolean
  4846. weekday?: string
  4847. era?: string
  4848. year?: string
  4849. month?: string
  4850. day?: string
  4851. hour?: string
  4852. minute?: string
  4853. second?: string
  4854. timeZoneName?: string
  4855. }
  4856. interface DateTimeFormat {
  4857. format(date?: Date | number): string
  4858. resolvedOptions(): ResolvedDateTimeFormatOptions
  4859. }
  4860. var DateTimeFormat: {
  4861. new (
  4862. locales?: string | string[],
  4863. options?: DateTimeFormatOptions
  4864. ): DateTimeFormat
  4865. (
  4866. locales?: string | string[],
  4867. options?: DateTimeFormatOptions
  4868. ): DateTimeFormat
  4869. supportedLocalesOf(
  4870. locales: string | string[],
  4871. options?: DateTimeFormatOptions
  4872. ): string[]
  4873. }
  4874. }
  4875. interface String {
  4876. /**
  4877. * Determines whether two strings are equivalent in the current or specified locale.
  4878. * @param that String to compare to target string
  4879. * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used. This parameter must conform to BCP 47 standards; see the Intl.Collator object for details.
  4880. * @param options An object that contains one or more properties that specify comparison options. see the Intl.Collator object for details.
  4881. */
  4882. localeCompare(
  4883. that: string,
  4884. locales?: string | string[],
  4885. options?: Intl.CollatorOptions
  4886. ): number
  4887. }
  4888. interface Number {
  4889. /**
  4890. * Converts a number to a string by using the current or specified locale.
  4891. * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
  4892. * @param options An object that contains one or more properties that specify comparison options.
  4893. */
  4894. toLocaleString(
  4895. locales?: string | string[],
  4896. options?: Intl.NumberFormatOptions
  4897. ): string
  4898. }
  4899. interface Date {
  4900. /**
  4901. * Converts a date and time to a string by using the current or specified locale.
  4902. * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
  4903. * @param options An object that contains one or more properties that specify comparison options.
  4904. */
  4905. toLocaleString(
  4906. locales?: string | string[],
  4907. options?: Intl.DateTimeFormatOptions
  4908. ): string
  4909. /**
  4910. * Converts a date to a string by using the current or specified locale.
  4911. * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
  4912. * @param options An object that contains one or more properties that specify comparison options.
  4913. */
  4914. toLocaleDateString(
  4915. locales?: string | string[],
  4916. options?: Intl.DateTimeFormatOptions
  4917. ): string
  4918. /**
  4919. * Converts a time to a string by using the current or specified locale.
  4920. * @param locales A locale string or array of locale strings that contain one or more language or locale tags. If you include more than one locale string, list them in descending order of priority so that the first entry is the preferred locale. If you omit this parameter, the default locale of the JavaScript runtime is used.
  4921. * @param options An object that contains one or more properties that specify comparison options.
  4922. */
  4923. toLocaleTimeString(
  4924. locales?: string | string[],
  4925. options?: Intl.DateTimeFormatOptions
  4926. ): string
  4927. }
  4928. `,
  4929. }