From b07628dddf418d4f47b858e6c35fd3520fbaeed2 Mon Sep 17 00:00:00 2001 From: mattkae Date: Tue, 7 Jun 2022 08:21:30 -0400 Subject: Flycheck mode and typescript --- elpa/tide-20220514.614/tide-autoloads.el | 98 + elpa/tide-20220514.614/tide-lv.el | 89 + elpa/tide-20220514.614/tide-lv.elc | Bin 0 -> 1757 bytes elpa/tide-20220514.614/tide-pkg.el | 17 + elpa/tide-20220514.614/tide.el | 3138 + elpa/tide-20220514.614/tide.elc | Bin 0 -> 119344 bytes elpa/tide-20220514.614/tsserver/lib.core.d.ts | 3840 + elpa/tide-20220514.614/tsserver/lib.core.es6.d.ts | 5128 + elpa/tide-20220514.614/tsserver/lib.d.ts | 24 + elpa/tide-20220514.614/tsserver/lib.dom.d.ts | 17791 ++ .../tsserver/lib.dom.iterable.d.ts | 323 + .../tsserver/lib.es2015.collection.d.ts | 89 + .../tsserver/lib.es2015.core.d.ts | 559 + elpa/tide-20220514.614/tsserver/lib.es2015.d.ts | 30 + .../tsserver/lib.es2015.generator.d.ts | 79 + .../tsserver/lib.es2015.iterable.d.ts | 497 + .../tsserver/lib.es2015.promise.d.ts | 78 + .../tsserver/lib.es2015.proxy.d.ts | 41 + .../tsserver/lib.es2015.reflect.d.ts | 123 + .../tsserver/lib.es2015.symbol.d.ts | 48 + .../tsserver/lib.es2015.symbol.wellknown.d.ts | 324 + .../tsserver/lib.es2016.array.include.d.ts | 118 + elpa/tide-20220514.614/tsserver/lib.es2016.d.ts | 22 + .../tsserver/lib.es2016.full.d.ts | 25 + elpa/tide-20220514.614/tsserver/lib.es2017.d.ts | 26 + .../tsserver/lib.es2017.full.d.ts | 25 + .../tsserver/lib.es2017.intl.d.ts | 32 + .../tsserver/lib.es2017.object.d.ts | 51 + .../tsserver/lib.es2017.sharedmemory.d.ts | 137 + .../tsserver/lib.es2017.string.d.ts | 47 + .../tsserver/lib.es2017.typedarrays.d.ts | 55 + .../tsserver/lib.es2018.asyncgenerator.d.ts | 79 + .../tsserver/lib.es2018.asynciterable.d.ts | 45 + elpa/tide-20220514.614/tsserver/lib.es2018.d.ts | 26 + .../tsserver/lib.es2018.full.d.ts | 25 + .../tsserver/lib.es2018.intl.d.ts | 73 + .../tsserver/lib.es2018.promise.d.ts | 32 + .../tsserver/lib.es2018.regexp.d.ts | 39 + .../tsserver/lib.es2019.array.d.ts | 85 + elpa/tide-20220514.614/tsserver/lib.es2019.d.ts | 25 + .../tsserver/lib.es2019.full.d.ts | 25 + .../tsserver/lib.es2019.object.d.ts | 35 + .../tsserver/lib.es2019.string.d.ts | 39 + .../tsserver/lib.es2019.symbol.d.ts | 26 + .../tsserver/lib.es2020.bigint.d.ts | 728 + elpa/tide-20220514.614/tsserver/lib.es2020.d.ts | 27 + .../tsserver/lib.es2020.full.d.ts | 25 + .../tsserver/lib.es2020.intl.d.ts | 368 + .../tsserver/lib.es2020.promise.d.ts | 49 + .../tsserver/lib.es2020.sharedmemory.d.ts | 99 + .../tsserver/lib.es2020.string.d.ts | 30 + .../tsserver/lib.es2020.symbol.wellknown.d.ts | 39 + elpa/tide-20220514.614/tsserver/lib.es2021.d.ts | 25 + .../tsserver/lib.es2021.full.d.ts | 25 + .../tsserver/lib.es2021.intl.d.ts | 44 + .../tsserver/lib.es2021.promise.d.ts | 50 + .../tsserver/lib.es2021.string.d.ts | 35 + .../tsserver/lib.es2021.weakref.d.ts | 75 + elpa/tide-20220514.614/tsserver/lib.es5.d.ts | 4495 + elpa/tide-20220514.614/tsserver/lib.es6.d.ts | 25 + .../tsserver/lib.esnext.array.d.ts | 223 + .../tsserver/lib.esnext.asynciterable.d.ts | 44 + .../tsserver/lib.esnext.bigint.d.ts | 629 + elpa/tide-20220514.614/tsserver/lib.esnext.d.ts | 22 + .../tsserver/lib.esnext.full.d.ts | 25 + .../tsserver/lib.esnext.intl.d.ts | 23 + .../tsserver/lib.esnext.promise.d.ts | 43 + .../tsserver/lib.esnext.string.d.ts | 35 + .../tsserver/lib.esnext.symbol.d.ts | 26 + .../tsserver/lib.esnext.weakref.d.ts | 75 + .../tide-20220514.614/tsserver/lib.scripthost.d.ts | 327 + elpa/tide-20220514.614/tsserver/lib.webworker.d.ts | 5733 + .../tsserver/lib.webworker.importscripts.d.ts | 26 + .../tsserver/lib.webworker.iterable.d.ts | 160 + elpa/tide-20220514.614/tsserver/tsconfig.json | 11 + elpa/tide-20220514.614/tsserver/tsserver.js | 175091 ++++++++++++++++++ .../tide-20220514.614/tsserver/typingsInstaller.js | 123432 ++++++++++++ 77 files changed, 345472 insertions(+) create mode 100644 elpa/tide-20220514.614/tide-autoloads.el create mode 100644 elpa/tide-20220514.614/tide-lv.el create mode 100644 elpa/tide-20220514.614/tide-lv.elc create mode 100644 elpa/tide-20220514.614/tide-pkg.el create mode 100644 elpa/tide-20220514.614/tide.el create mode 100644 elpa/tide-20220514.614/tide.elc create mode 100644 elpa/tide-20220514.614/tsserver/lib.core.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.core.es6.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.dom.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.dom.iterable.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2015.collection.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2015.core.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2015.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2015.generator.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2015.iterable.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2015.promise.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2015.proxy.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2015.reflect.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2015.symbol.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2015.symbol.wellknown.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2016.array.include.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2016.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2016.full.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2017.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2017.full.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2017.intl.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2017.object.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2017.sharedmemory.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2017.string.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2017.typedarrays.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2018.asyncgenerator.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2018.asynciterable.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2018.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2018.full.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2018.intl.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2018.promise.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2018.regexp.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2019.array.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2019.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2019.full.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2019.object.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2019.string.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2019.symbol.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2020.bigint.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2020.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2020.full.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2020.intl.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2020.promise.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2020.sharedmemory.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2020.string.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2020.symbol.wellknown.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2021.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2021.full.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2021.intl.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2021.promise.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2021.string.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es2021.weakref.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es5.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.es6.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.esnext.array.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.esnext.asynciterable.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.esnext.bigint.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.esnext.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.esnext.full.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.esnext.intl.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.esnext.promise.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.esnext.string.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.esnext.symbol.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.esnext.weakref.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.scripthost.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.webworker.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.webworker.importscripts.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/lib.webworker.iterable.d.ts create mode 100644 elpa/tide-20220514.614/tsserver/tsconfig.json create mode 100644 elpa/tide-20220514.614/tsserver/tsserver.js create mode 100644 elpa/tide-20220514.614/tsserver/typingsInstaller.js (limited to 'elpa/tide-20220514.614') diff --git a/elpa/tide-20220514.614/tide-autoloads.el b/elpa/tide-20220514.614/tide-autoloads.el new file mode 100644 index 0000000..1607871 --- /dev/null +++ b/elpa/tide-20220514.614/tide-autoloads.el @@ -0,0 +1,98 @@ +;;; tide-autoloads.el --- automatically extracted autoloads -*- lexical-binding: t -*- +;; +;;; Code: + +(add-to-list 'load-path (directory-file-name + (or (file-name-directory #$) (car load-path)))) + + +;;;### (autoloads nil "tide" "tide.el" (0 0 0 0)) +;;; Generated autoloads from tide.el + +(autoload 'company-tide "tide" "\ + + +\(fn COMMAND &optional ARG &rest IGNORED)" t nil) + +(autoload 'tide-format-before-save "tide" "\ +Before save hook to format the buffer before each save." t nil) + +(autoload 'tide-format "tide" "\ +Format the current region or buffer." t nil) + +(autoload 'tide-setup "tide" "\ +Setup `tide-mode' in current buffer." t nil) + +(autoload 'tide-mode "tide" "\ +Minor mode for Typescript Interactive Development Environment. + +This is a minor mode. If called interactively, toggle the `tide +mode' mode. If the prefix argument is positive, enable the mode, +and if it is zero or negative, disable the mode. + +If called from Lisp, toggle the mode if ARG is `toggle'. Enable +the mode if ARG is nil, omitted, or is a positive number. +Disable the mode if ARG is a negative number. + +To check whether the minor mode is enabled in the current buffer, +evaluate `tide-mode'. + +The mode's hook is called both when the mode is enabled and when +it is disabled. + +\\{tide-mode-map} + +\(fn &optional ARG)" t nil) + +(autoload 'tide-project-errors "tide" nil t nil) + +(autoload 'tide-unhighlight-identifiers "tide" "\ +Remove highlights from previously highlighted identifier." nil nil) + +(autoload 'tide-hl-identifier "tide" "\ +Highlight all instances of the identifier under point. Removes +highlights from previously highlighted identifier." t nil) + +(autoload 'tide-hl-identifier-mode "tide" "\ +Highlight instances of the identifier at point after a short +timeout. + +This is a minor mode. If called interactively, toggle the +`Tide-Hl-Identifier mode' mode. If the prefix argument is +positive, enable the mode, and if it is zero or negative, disable +the mode. + +If called from Lisp, toggle the mode if ARG is `toggle'. Enable +the mode if ARG is nil, omitted, or is a positive number. +Disable the mode if ARG is a negative number. + +To check whether the minor mode is enabled in the current buffer, +evaluate `tide-hl-identifier-mode'. + +The mode's hook is called both when the mode is enabled and when +it is disabled. + +\(fn &optional ARG)" t nil) + +(register-definition-prefixes "tide" '("tide-" "xref-tide-xref-backend")) + +;;;*** + +;;;### (autoloads nil "tide-lv" "tide-lv.el" (0 0 0 0)) +;;; Generated autoloads from tide-lv.el + +(register-definition-prefixes "tide-lv" '("tide-lv-")) + +;;;*** + +;;;### (autoloads nil nil ("tide-pkg.el") (0 0 0 0)) + +;;;*** + +;; Local Variables: +;; version-control: never +;; no-byte-compile: t +;; no-update-autoloads: t +;; coding: utf-8 +;; End: +;;; tide-autoloads.el ends here diff --git a/elpa/tide-20220514.614/tide-lv.el b/elpa/tide-20220514.614/tide-lv.el new file mode 100644 index 0000000..963c05a --- /dev/null +++ b/elpa/tide-20220514.614/tide-lv.el @@ -0,0 +1,89 @@ +;;; tide-lv.el --- Other echo area + +;; Copyright (C) 2015 Free Software Foundation, Inc. + +;; Author: Oleh Krehel + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: +;; +;; This package provides `tide-lv-message' intended to be used in place of +;; `message' when semi-permanent hints are needed, in order to not +;; interfere with Echo "Я тихо-тихо пiдглядаю, +;; І тiшуся собi, як бачу то, +;; Шо страшить i не пiдпускає, +;; А iншi п’ють тебе, як воду пiсок." L.V. +;; +;; +;; Modified version of lv.el from github.com/abo-abo/hydra + +;;; Code: + +(defvar tide-lv-buffer-name " *tide-LV*") + +(defvar tide-lv-wnd nil + "Holds the current LV window.") + +(defun tide-lv-window () + "Ensure that LV window is live and return it." + (if (window-live-p tide-lv-wnd) + tide-lv-wnd + (let ((ori (selected-window)) + buf) + (prog1 (setq tide-lv-wnd + (select-window + (let ((ignore-window-parameters t)) + (split-window + (frame-root-window) -1 'below)))) + (if (setq buf (get-buffer tide-lv-buffer-name)) + (switch-to-buffer buf) + (switch-to-buffer tide-lv-buffer-name) + (set-window-hscroll tide-lv-wnd 0) + (setq window-size-fixed t) + (setq mode-line-format nil) + (setq cursor-type nil) + (set-window-dedicated-p tide-lv-wnd t) + (set-window-parameter tide-lv-wnd 'no-other-window t)) + (select-window ori))))) + +(defun tide-lv-message (format-string &rest args) + "Set LV window contents to (`format' FORMAT-STRING ARGS)." + (let* ((str (apply #'format format-string args)) + (n-lines (cl-count ?\n str)) + deactivate-mark + golden-ratio-mode) + (with-selected-window (tide-lv-window) + (unless (string= (buffer-string) str) + (delete-region (point-min) (point-max)) + (insert str) + (set (make-local-variable 'window-min-height) n-lines) + (setq truncate-lines (> n-lines 1)) + (let ((window-resize-pixelwise t) + (window-size-fixed nil)) + (fit-window-to-buffer nil nil 1))) + (goto-char (point-min))))) + +(defun tide-lv-delete-window () + "Delete LV window and kill its buffer." + (when (window-live-p tide-lv-wnd) + (let ((buf (window-buffer tide-lv-wnd))) + (delete-window tide-lv-wnd) + (kill-buffer buf)))) + +(provide 'tide-lv) + +;;; tide-lv.el ends here diff --git a/elpa/tide-20220514.614/tide-lv.elc b/elpa/tide-20220514.614/tide-lv.elc new file mode 100644 index 0000000..0904a61 Binary files /dev/null and b/elpa/tide-20220514.614/tide-lv.elc differ diff --git a/elpa/tide-20220514.614/tide-pkg.el b/elpa/tide-20220514.614/tide-pkg.el new file mode 100644 index 0000000..ef55ace --- /dev/null +++ b/elpa/tide-20220514.614/tide-pkg.el @@ -0,0 +1,17 @@ +(define-package "tide" "20220514.614" "Typescript Interactive Development Environment" + '((emacs "25.1") + (dash "2.10.0") + (s "1.11.0") + (flycheck "27") + (typescript-mode "0.1") + (cl-lib "0.5")) + :commit "96bfc5da11a9b83b32368c38e933a405270652de" :authors + '(("Anantha kumaran" . "ananthakumaran@gmail.com")) + :maintainer + '("Anantha kumaran" . "ananthakumaran@gmail.com") + :keywords + '("typescript") + :url "http://github.com/ananthakumaran/tide") +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/elpa/tide-20220514.614/tide.el b/elpa/tide-20220514.614/tide.el new file mode 100644 index 0000000..588f6b8 --- /dev/null +++ b/elpa/tide-20220514.614/tide.el @@ -0,0 +1,3138 @@ +;;; tide.el --- Typescript Interactive Development Environment -*- lexical-binding: t -*- + +;; Copyright (C) 2015 Anantha Kumaran. + +;; Author: Anantha kumaran +;; URL: http://github.com/ananthakumaran/tide +;; Version: 4.5.4 +;; Keywords: typescript +;; Package-Requires: ((emacs "25.1") (dash "2.10.0") (s "1.11.0") (flycheck "27") (typescript-mode "0.1") (cl-lib "0.5")) + +;; This program is free software: you can redistribute it and/or modify it +;; under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; This program is distributed in the hope that it will be useful, but +;; WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +;; General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with this program. If not, see . + +;; This file is not part of GNU Emacs. + +;;; Commentary: + +;;; Code: + +(require 'typescript-mode) +(require 'etags) +(require 'json) +(require 'cl-lib) +(require 'eldoc) +(require 'dash) +(require 's) +(require 'flycheck) +(require 'imenu) +(require 'thingatpt) +(require 'tide-lv) +(require 'tabulated-list) +(require 'xref) + +;; Silence compiler warnings + +(defvar js2-basic-offset) +(defvar js-indent-level) +(defvar js3-indent-level) +(defvar web-mode-code-indent-offset) +(defvar sgml-basic-offset) +(defvar company-backends) + +(declare-function company-grab "company.el" (regexp &optional expression limit)) +(declare-function company-grab-symbol-cons "company.el" (idle-begin-after-re &optional max-len)) +(declare-function company-begin-backend "company.el" (backend &optional callback)) +(declare-function company-in-string-or-comment "company.el" nil) + +(defgroup tide nil + "TypeScript Interactive Development Environment." + :prefix "tide-" + :group 'tools) + +(defcustom tide-sync-request-timeout 2 + "The number of seconds to wait for a sync response." + :type 'integer + :group 'tide) + +(defcustom tide-tsserver-flags nil + "List of additional flags to provide when starting tsserver." + :type '(repeat string) + :group 'tide) + +(defcustom tide-tsserver-process-environment '() + "List of extra environment variables to use when starting tsserver." + :type '(repeat string) + :group 'tide) + +(defcustom tide-tsserver-executable nil + "Name of tsserver executable to run instead of the bundled tsserver. + +This may either be an absolute path or a relative path. Relative +paths are resolved against the project root directory. + +Note that this option only works with TypeScript version 2.0 and +above." + :type '(choice (const nil) string) + :group 'tide) + +(defcustom tide-tscompiler-executable nil + "Name of tsc executable. + +This may either be an absolute path or a relative path. Relative +paths are resolved against the project root directory." + :type '(choice (const nil) string) + :group 'tide) + +(defcustom tide-node-executable "node" + "Name or path of the node executable binary file." + :type '(choice (const nil) string) + :group 'tide) + +(defcustom tide-node-flags nil + "List of flags to provide to node when starting tsserver. + +Useful for large TypeScript codebases which need to set +max-old-space-size to a higher value." + :type '(repeat string) + :group 'tide) + +(defcustom tide-post-code-edit-hook nil + "Hook run after code edits are applied in a buffer." + :type 'hook + :group 'tide) + +(defcustom tide-sort-completions-by-kind nil + "Whether completions should be sorted by kind." + :type 'boolean + :group 'tide) + +(defcustom tide-format-options '() + "Format options plist." + :type '(plist :value-type sexp) + :group 'tide) + +(defcustom tide-user-preferences + '(:includeCompletionsForModuleExports t :includeCompletionsWithInsertText t :allowTextChangesInNewFiles t :generateReturnInDocTemplate t) + "User preference plist used on the configure request. + +Check https://github.com/Microsoft/TypeScript/blob/17eaf50b/src/server/protocol.ts#L2684 +for the full list of available options." + :type '(plist :value-type sexp) + :group 'tide) + +(defcustom tide-disable-suggestions nil + "Disable suggestions. + +If set to non-nil, suggestions will not be shown in flycheck +errors and tide-project-errors buffer." + :type 'boolean + :group 'tide) + +(defcustom tide-completion-setup-company-backend t + "Add `company-tide' to `company-backends'." + :type 'boolean + :group 'tide) + +(defcustom tide-completion-ignore-case nil + "CASE will be ignored in completion if set to non-nil." + :type 'boolean + :group 'tide) + +(defcustom tide-completion-show-source nil + "Completion dropdown will contain completion source if set to non-nil." + :type 'boolean + :group 'tide) + +(defcustom tide-completion-fuzzy nil + "Allow fuzzy completion. + +By default only candidates with exact prefix match are shown. If +set to non-nil, candidates with match anywhere inside the name +are shown." + :type 'boolean + :group 'tide) + +(defcustom tide-completion-detailed nil + "Completion dropdown will contain detailed method information if set to non-nil." + :type 'boolean + :group 'tide) + +(defcustom tide-completion-enable-autoimport-suggestions t + "Whether to include external module exports in completions." + :type 'boolean + :group 'tide) + +(defcustom tide-enable-xref t + "Whether to enable xref integration." + :type 'boolean + :group 'tide) + +(defcustom tide-navto-item-filter #'tide-navto-item-filter-default + "The filter for items returned by tide-nav. Defaults to class, interface, type, enum" + :type 'function + :group 'tide) + +(defface tide-file + '((t (:inherit font-lock-type-face))) + "Face for file names in references output." + :group 'tide) + +(defface tide-line-number + '((t (:inherit compilation-line-number))) + "Face for line numbers in references output." + :group 'tide) + +(defface tide-match + '((t (:inherit match))) + "Face for matched symbol in references output." + :group 'tide) + +(defface tide-imenu-type-face + '((t (:inherit font-lock-type-face))) + "Face for type in imenu list." + :group 'tide) + +(defface tide-choice-face + '((t (:inherit font-lock-warning-face))) + "Face for choices used in popup window." + :group 'tide) + +(defcustom tide-jump-to-definition-reuse-window t + "Reuse existing window when jumping to definition." + :type 'boolean + :group 'tide) + +(defcustom tide-imenu-flatten nil + "Imenu index will be flattened if set to non-nil." + :type 'boolean + :group 'tide) + +(defcustom tide-allow-popup-select '(code-fix refactor) + "The list of commands where popup selection is allowed." + :type '(set (const code-fix) (const jump-to-implementation) (const refactor)) + :group 'tide) + +(defcustom tide-always-show-documentation nil + "Show the documentation window even if only type information is available." + :type 'boolean + :group 'tide) + +(defcustom tide-server-max-response-length 102400 + "Maximum allowed response length from tsserver. Any response greater than this would be ignored." + :type 'integer + :group 'tide) + +(defcustom tide-tsserver-locator-function #'tide-tsserver-locater-npmlocal-projectile-npmglobal + "Function used by tide to locate tsserver." + :type 'function + :group 'tide) + +(defcustom tide-project-cleanup-delay 60 + "The number of idle seconds to wait before cleaning up unused tsservers. +Use `nil` to disable automatic cleanups. See also `tide-do-cleanups`." + :type '(choice (const nil) integer) + :group 'tide) + +(defcustom tide-tsserver-start-method 'immediate + "The method by which tide starts tsserver. `immediate' causes tide to start a tsserver instance +as soon as `tide-mode' is turned on. `manual' means that tide will start a tsserver only when the +user manually starts one." + :type '(choice (const :tag "Start immediately." immediate) + (const :tag "Require manual start." manual)) + :group 'tide) + +(defcustom tide-default-mode "TS" + "The default mode to open buffers not backed by files (e.g. Org +source blocks) in." + :type '(choice (const "TS") (const "TSX") (const "JS")(const "JSX")) + :group 'tide) + +(defcustom tide-recenter-after-jump t + "Recenter buffer after jumping to definition" + :type 'boolean + :group 'tide) + +(defcustom tide-jump-to-fallback #'tide-jump-to-fallback-not-given + "The fallback jump function to use when implementations aren't available." + :type 'function + :group 'tide) + +(defcustom tide-filter-out-warning-completions nil + "Completions whose `:kind' property is \"warning\" will be filtered out if set to non-nil. +This option is useful for Javascript code completion, because tsserver often returns a lot of irrelevant +completions whose `:kind' property is \"warning\" for Javascript code. You can fix this behavior by setting +this variable to non-nil value for Javascript buffers using `setq-local' macro." + :type 'boolean + :group 'tide + :safe #'booleanp) + +(defcustom tide-native-json-parsing (and (>= emacs-major-version 27) + (functionp 'json-serialize) + (functionp 'json-parse-buffer) + (functionp 'json-parse-string)) + "Use native JSON parsing (only emacs >= 27)." + :type 'boolean + :group 'tide) + +(defcustom tide-save-buffer-after-code-edit t + "Save the buffer after applying code edits." + :type 'boolean + :group 'tide) + +(defconst tide--minimal-emacs + "25.1" + "This is the oldest version of Emacs that tide supports.") + +(defmacro tide-def-permanent-buffer-local (name &optional init-value) + "Declare NAME as buffer local variable." + `(progn + (defvar ,name ,init-value) + (make-variable-buffer-local ',name) + (put ',name 'permanent-local t))) + +(defvar tide-supported-modes '(typescript-mode web-mode js-mode js2-mode js2-jsx-mode js3-mode rjsx-mode)) + +(defvar tide-server-buffer-name "*tide-server*") +(defvar tide-request-counter 0) +(defvar tide-project-configs (make-hash-table :test 'equal)) +(defvar tide-max-response-length-error-message + "Response length from tsserver is greater than maximum allowed response.") + +(tide-def-permanent-buffer-local tide-project-root nil) +(tide-def-permanent-buffer-local tide-buffer-dirty nil) +(tide-def-permanent-buffer-local tide-buffer-tmp-file nil) +(tide-def-permanent-buffer-local tide-active-buffer-file-name nil) +(tide-def-permanent-buffer-local tide-require-manual-setup nil) + +(defvar tide-servers (make-hash-table :test 'equal)) +(defvar tide-response-callbacks (make-hash-table :test 'equal)) + +(defvar tide-source-root-directory (file-name-directory (or load-file-name buffer-file-name))) +(defvar tide-tsserver-directory (expand-file-name "tsserver" tide-source-root-directory)) + +(defun tide-project-root () + "Project root folder determined based on the presence of tsconfig.json." + (or + tide-project-root + (let ((root (or (locate-dominating-file default-directory "tsconfig.json") + (locate-dominating-file default-directory "jsconfig.json")))) + (unless root + (message (tide-join (list "Couldn't locate project root folder with" + " a tsconfig.json or jsconfig.json file. Using '" + default-directory "' as project root."))) + (setq root default-directory)) + (let ((full-path (expand-file-name root))) + (setq tide-project-root full-path) + full-path)))) + +(defun tide-project-name () + (let ((full-path (directory-file-name (tide-project-root)))) + (concat (file-name-nondirectory full-path) "-" (substring (md5 full-path) 0 10)))) + +(defun tide-buffer-file-name () + "Returns the path to either the currently open file or the +current buffer's parent. This is needed to support indirect +buffers, as they don't set `buffer-file-name' correctly." + (buffer-file-name (or (and (bound-and-true-p edit-indirect--overlay) + (overlay-buffer edit-indirect--overlay)) + (and (bound-and-true-p org-src--overlay) + (overlay-buffer org-src--overlay)) + ;; Needed for org-mode 8.x compatibility + (and (bound-and-true-p org-edit-src-overlay) + (overlay-buffer org-edit-src-overlay)) + (buffer-base-buffer)))) + +;;; Compatibility + +(defvar tide-tsserver-unsupported-commands (make-hash-table :test 'equal)) + +(defun tide-mark-as-unsupported (command) + (puthash + (tide-project-name) + (cl-pushnew + command + (gethash (tide-project-name) tide-tsserver-unsupported-commands '())) + tide-tsserver-unsupported-commands)) + +(defun tide-unsupported-p (command) + (member command (gethash (tide-project-name) tide-tsserver-unsupported-commands '()))) + +(defmacro tide-fallback-if-not-supported (new-command new old cb) + `(if (tide-unsupported-p ,new-command) + (,old ,cb) + (,new + (lambda (response) + (if (tide-command-unknown-p response) + (progn + (tide-mark-as-unsupported ,new-command) + (,old ,cb)) + (funcall ,cb response)))))) + +(defun tide--emacs-at-least (version) + "Return t if Emacs is at least at version VERSION. Return nil, otherwise." + (not (version< emacs-version version))) + +;;; Helpers + +(defun tide-safe-json-read-file (filename) + (condition-case nil + (if tide-native-json-parsing + (with-temp-buffer + (insert-file-contents filename) + (goto-char (point-min)) + (json-parse-buffer :object-type 'plist :null-object json-null :false-object json-false)) + (let ((json-object-type 'plist)) + (json-read-file filename))) + (error '()))) + +(defun tide-safe-json-read-string (string) + (condition-case nil + (if tide-native-json-parsing + (json-parse-string string :object-type 'plist :null-object json-null :false-object json-false) + (let ((json-object-type 'plist)) + (json-read-from-string string))) + (error '()))) + +(defun tide-json-read-object () + (if tide-native-json-parsing + (json-parse-buffer :object-type 'plist :null-object json-null :false-object json-false :array-type 'list) + (let ((json-object-type 'plist) + (json-array-type 'list)) + (json-read-object)))) + +(defun tide-json-encode (obj) + "Encode OBJ into a JSON string. JSON arrays must be represented with vectors." + (if tide-native-json-parsing + (json-serialize obj :null-object json-null :false-object json-false) + (json-encode obj))) + +(defun tide-plist-get (list &rest args) + (cl-reduce + (lambda (object key) + (when object + (plist-get object key))) + args + :initial-value list)) + +(eval-and-compile + (defun tide-plist-map (fn plist) + (when (and plist (not (cl-evenp (length plist)))) + (error "Invalid plist %S" plist)) + (-map (-lambda ((key value)) (funcall fn key value)) (-partition 2 plist)))) + + +(defun tide-combine-plists (&rest plists) + "Create a single property list from all plists in PLISTS. +The process starts by copying the first list, and then setting properties +from the other lists. Settings in the last list are the most significant +ones and overrule settings in the other lists." + (let ((rtn (copy-sequence (pop plists))) + p v ls) + (while plists + (setq ls (pop plists)) + (while ls + (setq p (pop ls) v (pop ls)) + (setq rtn (plist-put rtn p v)))) + rtn)) + +(defun tide-get-file-buffer (file &optional new-file) + "Returns a buffer associated with a file. This will return the +current buffer if it matches `file'. This way we can support +temporary and indirect buffers." + (cond + ((equal file (tide-buffer-file-name)) (current-buffer)) + ((file-exists-p file) (find-file-noselect file)) + (new-file (let ((buffer (create-file-buffer file))) + (with-current-buffer buffer + (set-visited-file-name file) + (basic-save-buffer) + (display-buffer buffer t)) + buffer)) + (t (error "Invalid file %S" file)))) + +(defun tide-response-success-p (response) + (and response (equal (plist-get response :success) t))) + +(defun tide-command-unknown-p (response) + (and response (string-equal (plist-get response :command) "unknown"))) + +(defun tide-tsserver-version-not-supported () + (error "Only tsserver 2.0 or greater is supported. Upgrade your tsserver or use older version of tide.")) + +(defun tide-tsserver-feature-not-supported (min-version) + (error "tsserver %S or greater is required for this feature." min-version)) + +(defmacro tide-on-response-success (response &optional options &rest body) + "BODY must be a single expression if OPTIONS is not passed." + (declare (indent 2)) + (unless body + (setq body `(,options)) + (setq options '())) + (tide-plist-map + (lambda (key _value) + (unless (member key '(:ignore-empty :min-version)) + (error "Invalid options %S" options))) + options) + (let ((ignore-empty-response (plist-get options :ignore-empty)) + (min-version (plist-get options :min-version))) + `(cond ((and ,min-version (tide-command-unknown-p ,response)) (tide-tsserver-feature-not-supported ,min-version)) + ((tide-response-success-p ,response) + (progn + ,@body)) + (t + (-when-let (msg (plist-get ,response :message)) + (unless (and ,ignore-empty-response (string-equal msg "No content available.")) + (message "%s" msg)) + nil))))) + +(defmacro tide-on-response-success-callback (response &optional options &rest body) + (declare (indent 2)) + `(lambda (,response) + (tide-on-response-success ,response ,options + ,@body))) + +(defun tide-join (list) + (mapconcat 'identity list "")) + +(defun tide-each-buffer (project-name fn) + "Callback FN for each buffer within PROJECT-NAME with tide-mode enabled." + (-each (buffer-list) + (lambda (buffer) + (with-current-buffer buffer + (when (and (bound-and-true-p tide-mode) + (equal (tide-project-name) project-name)) + (funcall fn)))))) + +(defun tide-first-buffer (project-name fn) + "Callback FN for the first buffer within PROJECT-NAME with tide-mode enabled." + (-when-let (buffer (-first (lambda (buffer) + (with-current-buffer buffer + (and (bound-and-true-p tide-mode) + (equal (tide-project-name) project-name)))) + (buffer-list))) + (with-current-buffer buffer + (funcall fn)))) + +(defun tide-line-number-at-pos (&optional pos) + (let ((p (or pos (point)))) + (if (= (point-min) 1) + (line-number-at-pos p) + (save-excursion + (save-restriction + (widen) + (line-number-at-pos p)))))) + +(defun tide-current-offset () + "Number of characters present from the begining of line to cursor in current line. + +Offset is one based." + (1+ (- (point) (line-beginning-position)))) + +(defun tide-offset (pos) + (save-excursion + (save-restriction + (widen) + (goto-char pos) + (tide-current-offset)))) + +(defun tide-span-to-position (span) + (save-excursion + (save-restriction + (widen) + (goto-char (point-min)) + (forward-line (1- (plist-get span :line))) + (beginning-of-line) + (forward-char (1- (plist-get span :offset))) + (point)))) + +(defun tide-file-span-first-line-text (file-span &optional string) + (let (end-offset text) + (save-excursion + (with-current-buffer (tide-get-file-buffer (plist-get file-span :file)) + (tide-move-to-location (plist-get file-span :start)) + (when string + (search-forward string (tide-location-to-point (plist-get file-span :end))) + (setq end-offset (current-column))) + (setq text (substring-no-properties (replace-regexp-in-string "\n" "" (thing-at-point 'line)))) + (when string + (put-text-property (- end-offset (length string)) end-offset 'face 'tide-match text)) + text)))) + +(defun tide-display-help-buffer (feature body) + (let ((buffer (tide-make-help-buffer feature body))) + (display-buffer buffer t) + (if help-window-select + (progn + (pop-to-buffer buffer) + (message "Type \"q\" to restore previous buffer")) + (message (concat "Type \"q\" in the " feature " buffer to close it"))))) + +(defun tide-make-help-buffer (feature body) + (with-current-buffer (get-buffer-create (concat "*tide-" feature "*")) + (setq buffer-read-only t) + (let ((inhibit-read-only t)) + (erase-buffer) + (when body + (save-excursion + (tide-insert body)))) + (local-set-key (kbd "q") #'quit-window) + (current-buffer))) + + +(defvar tide-alphabets '(?a ?s ?d ?f ?j ?k ?l)) + +(defun tide-popup-select-item (prompt list) + (let ((hints (-map-indexed + (lambda (i item) + (concat (propertize (char-to-string (nth i tide-alphabets)) 'face 'tide-choice-face) + " " + item)) + list))) + (unwind-protect + (progn + (tide-lv-message (mapconcat 'identity hints "\n")) + (let ((selected (read-char-choice prompt (-take (length list) tide-alphabets)))) + (nth (-find-index (lambda (char) (eql selected char)) tide-alphabets) list))) + (tide-lv-delete-window)))) + +(defun tide-completing-read-select-item (prompt list) + (completing-read prompt list nil t)) + +(defun tide-can-use-popup-p (feature) + (member feature tide-allow-popup-select)) + +(defun tide-select-item-from-list (prompt list label-fn allow-popup) + (let ((collection (make-hash-table :test 'equal))) + (dolist (item list) + (puthash (funcall label-fn item) item collection)) + (let ((selected-text + (if (and (<= (length list) (length tide-alphabets)) allow-popup) + (tide-popup-select-item prompt (hash-table-keys collection)) + (tide-completing-read-select-item prompt (hash-table-keys collection))))) + (gethash selected-text collection)))) + + +(defun tide-command-to-string (program args) + (with-temp-buffer + (apply #'process-file (-concat (list program nil t nil) args)) + (buffer-string))) + +;;; Events + +(defvar tide-event-listeners (make-hash-table :test 'equal)) + +(defun tide-set-event-listener (listener) + (puthash (tide-project-name) (cons (current-buffer) listener) tide-event-listeners)) + +(defun tide-clear-event-listener () + (remhash (tide-project-name) tide-event-listeners)) + +;;; Server + +(defun tide-current-server () + (gethash (tide-project-name) tide-servers)) + +(defun tide-next-request-id () + (number-to-string (cl-incf tide-request-counter))) + +(defun tide-dispatch-response (response) + (let* ((request-id (plist-get response :request_seq)) + (callback (gethash request-id tide-response-callbacks))) + (when callback + (let ((buffer (car callback))) + (when (buffer-live-p buffer) + (with-current-buffer buffer + (apply (cdr callback) (list response))))) + (remhash request-id tide-response-callbacks)))) + +(defun tide-dispatch-event (event) + (-when-let (listener (gethash (tide-project-name) tide-event-listeners)) + (with-current-buffer (car listener) + (apply (cdr listener) (list event))))) + +(defun tide-dispatch (response) + (cl-case (intern (plist-get response :type)) + ((response) (tide-dispatch-response response)) + ((event) (tide-dispatch-event response)))) + +(defun tide-send-command (name args &optional callback) + (unless (tide-current-server) + (error "Server does not exist. Run M-x tide-restart-server to start it again")) + + (tide-sync-buffer-contents) + + (let* ((request-id (tide-next-request-id)) + (command `(:command ,name :seq ,request-id :arguments ,args)) + (json-encoding-pretty-print nil) + (encoded-command (tide-json-encode command)) + (payload (concat encoded-command "\n"))) + (process-send-string (tide-current-server) payload) + (when callback + (puthash request-id (cons (current-buffer) callback) tide-response-callbacks)))) + +(defun tide-seconds-elapsed-since (time) + (time-to-seconds (time-subtract (current-time) time))) + +(defun tide-send-command-sync (name args) + (let* ((start-time (current-time)) + (response nil)) + (tide-send-command name args (lambda (resp) (setq response resp))) + (while (not response) + (accept-process-output nil 0.01) + (when (> (tide-seconds-elapsed-since start-time) tide-sync-request-timeout) + (error "Sync request timed out %s" name))) + response)) + +(defun tide-net-filter (process data) + (with-current-buffer (process-buffer process) + (goto-char (point-max)) + (insert data)) + (tide-decode-response process)) + +(defun tide-net-sentinel (process message) + (let ((project-name (process-get process 'project-name))) + (message "(%s) tsserver exits: %s." project-name (string-trim message)) + (ignore-errors + (kill-buffer (process-buffer process))) + (tide-cleanup-project project-name))) + +(defun tide--npm-local () + "Return a single path to the package-local typescript package directory or nil." + + (-when-let (packages-folder (locate-dominating-file default-directory "package.json")) + (concat packages-folder "node_modules/typescript/lib/"))) + +(defun tide--npm-global () + "Return a single path to the global typescript package directory or nil." + + (if (eq system-type 'windows-nt) + (concat (getenv "appdata") "\\npm\\node_modules") + "/usr/lib/node_modules/typescript/lib/")) + +(defun tide--npm-global-usrlocal () + "Return a single path to the global typescript package directory or nil." + + ;; this check does not apply to windows. + (if (eq system-type 'windows-nt) + nil + "/usr/local/lib/node_modules/typescript/lib/")) + +(defun tide--project-package () + "Return the package's node_module bin directory using projectile's project root or nil." + (when (and (functionp 'projectile-project-p) + (functionp 'projectile-project-root) + (projectile-project-p)) + (concat (projectile-project-root) "node_modules/typescript/lib"))) + +(defconst tide--tscompiler "tsc.js" + "File-name of the typescript compiler.") + +(defun tide--locate-tscompiler (path) + "Locate the typescript compiler in PATH. +Return a string representing the existing full path or nil." + (let ((exe (expand-file-name tide--tscompiler path))) + (when (file-exists-p exe) exe))) + +(defun tide-tscompiler-locater-npmlocal-projectile-npmglobal () + "Locate tsserver through project-local or global system settings." + (or + (tide--locate-tscompiler (tide--npm-local)) + (tide--locate-tscompiler (tide--project-package)) + (tide--locate-tscompiler (tide--npm-global)) + (tide--locate-tscompiler (tide--npm-global-usrlocal)))) + +(defun tide-locate-tscompiler-executable () + "Locate the typescript compiler executable. +If TIDE-TSCOMPILER-EXECUTABLE is set by the user use it. Otherwise check in the +npm local package directory, in the project root as defined by projectile, and +in the npm global installation." + (or + (and tide-tscompiler-executable (expand-file-name tide-tscompiler-executable)) + (tide-tscompiler-locater-npmlocal-projectile-npmglobal))) + +(defconst tide--tsserver "tsserver.js" + "File-name of the file that node executes to start the typescript server.") + +(defun tide--locate-tsserver (path) + "Locate the typescript server in PATH. +Return a string representing the existing full path or nil." + (let ((exe (expand-file-name tide--tsserver path))) + (when (file-exists-p exe) exe))) + +(defun tide-tsserver-locater-npmlocal-projectile-npmglobal () + "Locate tsserver through project-local or global system settings." + (or + (tide--locate-tsserver (tide--npm-local)) + (tide--locate-tsserver (tide--project-package)) + (tide--locate-tsserver (tide--npm-global)) + (tide--locate-tsserver (tide--npm-global-usrlocal)))) + +(defun tide-locate-tsserver-executable () + "Locate the typescript server executable. +If TIDE-TSSERVER-EXECUTABLE is set by the user use it. Otherwise check in the +npm local package directory, in the project root as defined by projectile, and +in the npm global installation. If nothing is found use the bundled version." + (or + (and tide-tsserver-executable (expand-file-name tide-tsserver-executable)) + (funcall tide-tsserver-locator-function) + (expand-file-name tide--tsserver tide-tsserver-directory))) + +(defun tide-start-server () + (when (tide-current-server) + (error "Server already exist")) + + (message "(%s) Starting tsserver..." (tide-project-name)) + (let* ((default-directory (tide-project-root)) + (process-environment (append tide-tsserver-process-environment process-environment)) + (buf (generate-new-buffer tide-server-buffer-name)) + (tsserverjs (tide-locate-tsserver-executable)) + ;; Use a pipe to communicate with the subprocess. This fixes a hang + ;; when a >1k message is sent on macOS. + (process-connection-type nil) + (node-process-arguments (append tide-node-flags (list tsserverjs) tide-tsserver-flags)) + (process + (apply #'start-file-process "tsserver" buf tide-node-executable node-process-arguments))) + (set-process-coding-system process 'utf-8-unix 'utf-8-unix) + (set-process-filter process #'tide-net-filter) + (set-process-sentinel process #'tide-net-sentinel) + (set-process-query-on-exit-flag process nil) + (with-current-buffer (process-buffer process) + (buffer-disable-undo)) + (process-put process 'project-name (tide-project-name)) + (process-put process 'project-root default-directory) + (puthash (tide-project-name) process tide-servers) + (message "(%s) tsserver server started successfully." (tide-project-name)) + (tide-each-buffer (tide-project-name) #'tide-configure-buffer))) + +(defun tide-cleanup-buffer-callbacks () + (let ((error-response `(:success ,nil))) + (maphash + (lambda (id callback) + (when (equal (current-buffer) (car callback)) + (funcall (cdr callback) error-response) + (remhash id tide-response-callbacks))) + tide-response-callbacks))) + +(defun tide-cleanup-project (project-name) + (tide-each-buffer project-name + (lambda () + (tide-cleanup-buffer-callbacks))) + (tide-cleanup-project-data project-name)) + +(defun tide-cleanup-project-data (project-name) + (remhash project-name tide-servers) + (remhash project-name tide-tsserver-unsupported-commands) + (remhash project-name tide-project-configs)) + +(defvar tide--cleanup-timer nil) +(defvar tide--cleanup-kinds nil) +(defun tide-schedule-cleanup (kind) + (cl-pushnew kind tide--cleanup-kinds) + (when (and tide-project-cleanup-delay (not tide--cleanup-timer)) + (setq tide--cleanup-timer + (run-with-idle-timer tide-project-cleanup-delay nil + #'tide-do-cleanups)))) +(defun tide-schedule-dead-projects-cleanup () + (tide-schedule-cleanup 'dead-projects)) +(defun tide-schedule-tmp-file-cleanup () + (tide-schedule-cleanup 'tmp-file)) +(defun tide-do-cleanups (&optional interactivep) + "Perform some cleanups. + +This function is used when Emacs is idle (see `tide-project-cleanup-delay'), +and you can also call it interactively (e.g., if you disable the automatic +behavior). + +Currently, two kinds of cleanups are done: +* Remove projects that don't have any associated live buffers, and kill their + tsserver processes. +* Remove tmp files for buffers that are saved." + (interactive '(t)) + (let ((kinds (if interactivep '(dead-projects tmp-file) tide--cleanup-kinds)) + (live-projects '()) + (buffers-w/tmp '())) + (dolist (b (buffer-list)) + (with-current-buffer b + (when (bound-and-true-p tide-mode) + (cl-pushnew (tide-project-name) live-projects)) + (when (bound-and-true-p tide-buffer-tmp-file) + (cl-pushnew b buffers-w/tmp)))) + (setq tide--cleanup-timer nil tide--cleanup-kinds nil) + (when (memq 'dead-projects kinds) + (-when-let (to-kill (-difference (hash-table-keys tide-servers) live-projects)) + (message "Cleaning up %d projects..." (length to-kill)) + (dolist (proj to-kill) + (delete-process (process-buffer (gethash proj tide-servers))) + (tide-cleanup-project-data proj)))) + (when (and (consp buffers-w/tmp) (memq 'tmp-file kinds)) + (message "Cleaning up %d tmp files..." (length buffers-w/tmp)) + (dolist (b buffers-w/tmp) + (with-current-buffer b (tide-remove-tmp-file)))) + (unless interactivep + (sit-for 5) + (message nil)))) + +(defun tide-start-server-if-nonexistent () + "Start a tsserver instance if there is not one already running." + (unless (tide-current-server) + (tide-start-server))) + +(defun tide-decode-response-legth () + (goto-char (point-min)) + (when (re-search-forward "Content-Length: \\([0-9]+\\)" nil t) + (string-to-number (match-string 1)))) + +(defun tide-enough-response-p (length) + (save-excursion + (when (search-forward "{" nil t) + (backward-char 1) + (>= (- (position-bytes (point-max)) (position-bytes (point))) (1- length))))) + +(defun tide-decode-response (process) + (with-current-buffer (process-buffer process) + (let ((length (tide-decode-response-legth))) + (when (and length (tide-enough-response-p length)) + (search-forward "{") + (backward-char 1) + (let ((response (if (> length tide-server-max-response-length) + (let ((seq (when (re-search-forward "\"request_seq\":\"\\([0-9]+\\)\"" nil t) + (match-string 1)))) + (forward-line 1) + (and seq + `(:success :json-false :type "response" + :message ,tide-max-response-length-error-message + :request_seq ,seq))) + (tide-json-read-object)))) + (delete-region (point-min) (point)) + (when response + (tide-dispatch response))) + (when (>= (buffer-size) 16) + (tide-decode-response process)))))) + +;;; Initialization + +(defun tide-file-format-options () + (tide-combine-plists + `(:tabSize ,tab-width :indentSize ,(tide-current-indentsize)) + tide-format-options + (tide-tsfmt-options))) + +(defun tide-tsfmt-options () + (let ((config-file (expand-file-name "tsfmt.json" (tide-project-root)))) + (when (file-exists-p config-file) + (tide-safe-json-read-file config-file)))) + +(defun tide-current-indentsize () + (pcase major-mode + (`typescript-mode typescript-indent-level) + (`js2-mode js2-basic-offset) + (`js-mode js-indent-level) + (`js3-mode js3-indent-level) + (`web-mode web-mode-code-indent-offset) + (`js2-jsx-mode sgml-basic-offset) + (`rjsx-mode sgml-basic-offset) + (_ standard-indent))) + +(defun tide-command:configure () + (tide-send-command + "configure" + `(:hostInfo ,(emacs-version) :file ,(tide-buffer-file-name) + :formatOptions ,(tide-file-format-options) :preferences ,tide-user-preferences))) + +(defun tide-command:projectInfo (cb &optional need-file-name-list file) + (tide-send-command "projectInfo" `(:file ,(or file (tide-buffer-file-name)) :needFileNameList ,need-file-name-list) cb)) + +(defun tide-command:openfile () + (tide-send-command "open" + (if tide-require-manual-setup + `(:file + ,(tide-buffer-file-name) + :scriptKindName ,tide-default-mode + :fileContent ,(buffer-string)) + (append `(:file ,(tide-buffer-file-name)) + (let ((extension (upcase (or (file-name-extension (tide-buffer-file-name)) "")))) + (when (member extension '("TS" "JS" "TSX" "JSX")) + `(:scriptKindName ,extension))))))) + +(defun tide-command:closefile () + (tide-send-command "close" `(:file ,(tide-buffer-file-name)))) + +;;; Jump to definition + +(defun tide-command:definition (&optional cb location) + (let ((location (or location + `(:file ,(tide-buffer-file-name) + :line ,(tide-line-number-at-pos) + :offset ,(tide-current-offset))))) + (if cb + (tide-send-command "definition" location cb) + (tide-send-command-sync "definition" location)))) + +(defun tide-command:typeDefinition (cb) + (tide-send-command + "typeDefinition" + `(:file ,(tide-buffer-file-name) :line ,(tide-line-number-at-pos) :offset ,(tide-current-offset)) + cb)) + +(defun tide-jump-to-definition (&optional arg) + "Jump to the definition of the symbol at point. + +If pointed at an abstract member-declaration, will proceed to look for +implementations. When invoked with a prefix arg, jump to the type definition." + (interactive "P") + (let ((cb (lambda (response) + (tide-on-response-success response + (-when-let (filespan (car (plist-get response :body))) + ;; if we're still at the same location... + ;; maybe we're a abstract member which has implementations? + (if (and (not arg) + (tide-filespan-is-current-location-p filespan)) + (tide-jump-to-implementation) + (tide-jump-to-filespan filespan tide-jump-to-definition-reuse-window))))))) + (if arg + (tide-command:typeDefinition cb) + (tide-command:definition cb)))) + +(defun tide-filespan-is-current-location-p (filespan) + (let* ((location (plist-get filespan :start)) + (new-file-name (plist-get filespan :file))) + (and (string-equal new-file-name (tide-buffer-file-name)) + (equal (tide-location-to-point location) (point))))) + +(defun tide-move-to-location (location) + (let* ((line (plist-get location :line)) + (offset (plist-get location :offset))) + (save-restriction + (widen) + (goto-char (point-min)) + (forward-line (1- line))) + (unless (and (= offset 0) (= line 0)) + (forward-char (1- offset))))) + +(defun tide-location-to-point (location) + (save-excursion + (tide-move-to-location location) + (point))) + +(defun tide-recenter-p (filespan &optional recenter-pref) + (when recenter-pref + (let ((new-file-name (plist-get filespan :file))) + (if (string-equal new-file-name (tide-buffer-file-name)) + (tide-recenter-in-same-buffer-p filespan) + t)))) + +(defun tide-recenter-in-same-buffer-p (filespan) + (let* ((newpos (plist-get (plist-get filespan :start) :line)) + (line-diff (abs (- (line-number-at-pos) newpos)))) + (> line-diff (window-body-height)))) + +(defun tide-jump-to-filespan (filespan &optional reuse-window no-marker) + (let ((file (plist-get filespan :file)) + (should-recenter-p (tide-recenter-p filespan tide-recenter-after-jump))) + (unless no-marker + (xref-push-marker-stack)) + (if reuse-window + (pop-to-buffer (tide-get-file-buffer file) '((display-buffer-reuse-window display-buffer-same-window))) + (pop-to-buffer (tide-get-file-buffer file))) + (tide-move-to-location (plist-get filespan :start)) + (when should-recenter-p + (recenter)))) + +(defalias 'tide-jump-back 'pop-tag-mark) + +;;; Jump to implementation + +(defun tide-jump-to-fallback-not-given () + (message "No implementations available.")) + +(defun tide-command:implementation () + (tide-send-command-sync + "implementation" + `(:file ,(tide-buffer-file-name) :line ,(tide-line-number-at-pos) :offset ,(tide-current-offset)))) + +(defun tide-jump-to-implementation-format-item (item) + (let* ((file-name (plist-get item :file)) + (line (tide-file-span-first-line-text item)) + (file-pos (concat + (propertize (file-name-nondirectory file-name) + 'face 'tide-file) + ":" + (propertize (number-to-string (tide-plist-get item :start :line)) + 'face 'tide-line-number)))) + (concat + line + " " + file-pos))) + +(defun tide-jump-to-implementation () + "Jump to a implementation of the symbol at point." + (interactive) + (let ((response (tide-command:implementation))) + (tide-on-response-success response + (let ((impls (plist-get response :body))) + (cl-case (length impls) + ((0) (funcall tide-jump-to-fallback)) + ((1) (tide-jump-to-filespan (car impls))) + (t (tide-jump-to-filespan + (tide-select-item-from-list "Select implementation: " impls + #'tide-jump-to-implementation-format-item + (tide-can-use-popup-p 'jump-to-implementation))))))))) + +;;; Navigate to named member + +(defun tide-in-string-p () + (nth 3 (syntax-ppss))) + +(defun tide-get-symbol-at-point () + "Returns the symbol found at point, if not deemed 'noise'. +Noise can be anything like braces, reserved keywords, etc." + + (unless (or (tide-in-string-p) + (member (face-at-point) '(font-lock-keyword-face))) + ;; we could have used symbol-at-point here, but that leaves us unable to + ;; differentiate between a symbol named nil and no symbol at all. + ;; thing-at-point returns a string OR nil, which means we don't get this problem. + (let ((symbol (thing-at-point 'symbol))) + (substring-no-properties (if (equal nil symbol) "" symbol))))) + +(defun tide-nav (arg) + "Search and navigate to named types." + (interactive "P") + (let ((completion-ignore-case t) + (last-completions nil) + (default (when arg (tide-get-symbol-at-point)))) + (-when-let (completion + (completing-read-default + "Search: " + (completion-table-dynamic + (lambda (prefix) + (let ((response (tide-command:navto prefix))) + (tide-on-response-success response + (-when-let (navto-items (plist-get response :body)) + (setq navto-items (funcall tide-navto-item-filter navto-items)) + (setq last-completions navto-items) + (-map (lambda (navto-item) (plist-get navto-item :name)) + navto-items))))) + t) nil t default)) + (let ((navto-item (-find (lambda (navto-item) (string-equal completion (plist-get navto-item :name))) + last-completions))) + (tide-jump-to-filespan navto-item))))) + +(defun tide-navto-item-filter-default (navto-items) + (-filter + (lambda (navto-item) (member (plist-get navto-item :kind) '("class" "interface" "type" "enum"))) + navto-items)) + +(defun tide-command:navto (type &optional current-file-only) + (tide-send-command-sync "navto" `(:file ,(tide-buffer-file-name) :searchValue ,type :maxResultCount 100 :currentFileOnly ,(or current-file-only :json-false)))) + +;;; Eldoc + +(defun tide-annotate-display-part (display-part &optional highlight) + (let ((text (plist-get display-part :text)) + (face (pcase (plist-get display-part :kind) + ("aliasName" 'font-lock-type-face) + ("className" 'font-lock-type-face) + ("enumName" 'font-lock-type-face) + ("fieldName" nil) + ("interfaceName" 'font-lock-type-face) + ("keyword" 'font-lock-keyword-face) + ("lineBreak" nil) + ("numericLiteral" nil) + ("stringLiteral" 'font-lock-string-face) + ("localName" 'font-lock-variable-name-face) + ("methodName" nil) + ("moduleName" nil) + ("operator" nil) + ("parameterName" (and highlight 'eldoc-highlight-function-argument)) + ("propertyName" nil) + ("punctuation" nil) + ("space" nil) + ("text" nil) + ("typeParameterName" 'font-lock-variable-name-face) + ("enumMemberName" 'font-lock-constant-face) + ("functionName" 'font-lock-function-name-face) + ("regularExpressionLiteral" 'font-lock-string-face)))) + (if face + (propertize text 'face face) + text))) + +(defun tide-annotate-display-parts (display-parts &optional highlight) + (tide-join (-map (lambda (part) (tide-annotate-display-part part highlight)) display-parts))) + +(defun tide-annotate-signature-parameter (parameter highlight) + (tide-join + (-map + (lambda (part) (tide-annotate-display-part part highlight)) + (plist-get parameter :displayParts)))) + +(defun tide-annotate-signature (signature selected-arg-index) + (let ((separator (tide-join (-map #'tide-annotate-display-part (plist-get signature :separatorDisplayParts))))) + (tide-join + (-concat + (-map #'tide-annotate-display-part (plist-get signature :prefixDisplayParts)) + (list + (mapconcat + #'identity + (-map-indexed + (lambda (i parameter) + (tide-annotate-signature-parameter parameter (eq i selected-arg-index))) + (plist-get signature :parameters)) + separator)) + (-map #'tide-annotate-display-part (plist-get signature :suffixDisplayParts)))))) + +(defun tide-annotate-signatures (body) + (let ((selected-index (plist-get body :selectedItemIndex)) + (selected-arg-index (plist-get body :argumentIndex))) + (tide-annotate-signature + (nth selected-index (plist-get body :items)) + selected-arg-index))) + +(defun tide-command:signatureHelp (cb) + (tide-send-command + "signatureHelp" + `(:file ,(tide-buffer-file-name) :line ,(tide-line-number-at-pos) :offset ,(tide-current-offset)) + (tide-on-response-success-callback response (:ignore-empty t) + (funcall cb (tide-annotate-signatures (plist-get response :body)))))) + +(defun tide-method-call-p () + (or (looking-at "[(,]") + (and (not (looking-at "\\sw")) (looking-back "[(,]\n?\\s-*" nil)))) + +(defun tide-doc-text (quickinfo-or-completion-detail) + (or (plist-get quickinfo-or-completion-detail :displayString) ;; old + (tide-annotate-display-parts + (plist-get quickinfo-or-completion-detail :displayParts)))) + +(defun tide-doc-documentation (quickinfo-or-completion-detail) + (let ((documentation (plist-get quickinfo-or-completion-detail :documentation))) + (if (stringp documentation) ;; old + documentation + (tide-annotate-display-parts documentation)))) + +(defun tide-format-jsdoc (name text) + (setq text (s-trim (or text ""))) + (concat (propertize (concat "@" name) 'face 'font-lock-keyword-face) + (if (s-contains? "\n" text) "\n" " ") + text + "\n")) + +(defun tide-doc-jsdoc (quickinfo-or-completion-detail) + (tide-join + (-map + (lambda (tag) + (tide-format-jsdoc (plist-get tag :name) (plist-get tag :text))) + (plist-get quickinfo-or-completion-detail :tags)))) + +(defun tide-construct-documentation (quickinfo-or-completion-detail) + (when quickinfo-or-completion-detail + (let* ((display-string (tide-doc-text quickinfo-or-completion-detail)) + (documentation (tide-doc-documentation quickinfo-or-completion-detail)) + (jsdoc (tide-doc-jsdoc quickinfo-or-completion-detail))) + (when (or (or (not (s-blank? documentation)) + (not (s-blank? jsdoc))) + tide-always-show-documentation) + (tide-join + (-concat (list display-string "\n\n") + (if (not (s-blank? documentation)) (list documentation "\n\n") '()) + (list jsdoc))))))) + +(defun tide-command:quickinfo-old (cb) + (tide-send-command "quickinfo" + `(:file ,(tide-buffer-file-name) + :line ,(tide-line-number-at-pos) :offset ,(tide-current-offset)) cb)) + +(defun tide-command:quickinfo-full (cb) + (tide-send-command "quickinfo-full" + `(:file ,(tide-buffer-file-name) + :line ,(tide-line-number-at-pos) :offset ,(tide-current-offset)) + cb)) + +(defun tide-command:quickinfo (cb) + (tide-fallback-if-not-supported "quickinfo-full" tide-command:quickinfo-full tide-command:quickinfo-old cb)) + + +(defun tide-eldoc-function () + (unless (member last-command '(next-error previous-error)) + (if (tide-method-call-p) + (tide-command:signatureHelp #'tide-eldoc-maybe-show) + (when (looking-at "\\s_\\|\\sw") + (tide-command:quickinfo + (tide-on-response-success-callback response (:ignore-empty t) + (tide-eldoc-maybe-show (tide-doc-text (plist-get response :body)))))))) + nil) + +(defun tide-eldoc-display-message-p() + (if (fboundp 'eldoc-display-message-no-interference-p) + (eldoc-display-message-no-interference-p) + (eldoc-display-message-p))) + +;;; Copied from eldoc.el +(defun tide-eldoc-maybe-show (text) + (with-demoted-errors "eldoc error: %s" + (and (or (tide-eldoc-display-message-p) + ;; Erase the last message if we won't display a new one. + (when eldoc-last-message + (eldoc-message nil) + nil)) + (eldoc-message text)))) + +(defun tide-documentation-at-point () + "Show documentation of the symbol at point." + (interactive) + (tide-command:quickinfo + (tide-on-response-success-callback response + (-if-let (body (tide-construct-documentation (plist-get response :body))) + (tide-display-help-buffer "documentation" body) + (message "No documentation available."))))) + +;;; Buffer Sync + +(defun tide-remove-tmp-file () + (when tide-buffer-tmp-file + (delete-file tide-buffer-tmp-file) + (setq tide-buffer-tmp-file nil))) + +(defun tide-command:reloadfile () + (tide-send-command "reload" `(:file ,(tide-buffer-file-name) :tmpfile ,(tide-buffer-file-name)))) + +(defun tide-handle-change (_beg _end _len) + (setq tide-buffer-dirty t)) + +(defun tide-sync-buffer-contents () + ;; The real file that backs a buffer could be changed in various + ;; ways, one common example is the rename operation. Ensure that we + ;; send the open command for the new file before using it as an + ;; argument for any other command. + (unless (string-equal tide-active-buffer-file-name (tide-buffer-file-name)) + (tide-configure-buffer)) + (when (and tide-buffer-tmp-file (not (buffer-modified-p))) + (tide-schedule-tmp-file-cleanup)) + (when tide-buffer-dirty + (setq tide-buffer-dirty nil) + (unless tide-buffer-tmp-file + (setq tide-buffer-tmp-file (make-temp-file "tide"))) + (save-restriction + (widen) + (write-region (point-min) (point-max) tide-buffer-tmp-file nil 'no-message)) + (tide-send-command "reload" `(:file ,(tide-buffer-file-name) :tmpfile ,tide-buffer-tmp-file)))) + +;;; Code-fixes + +(defun tide-apply-code-edits (file-code-edits) + (save-excursion + (dolist (file-code-edit file-code-edits) + (let ((file (plist-get file-code-edit :fileName))) + (with-current-buffer (tide-get-file-buffer file t) + (tide-format-regions (tide-apply-edits (plist-get file-code-edit :textChanges))) + ;; Saving won't work if the current buffer is temporary or an indirect + ;; buffer + (when (and tide-save-buffer-after-code-edit (equal buffer-file-name file)) + (basic-save-buffer)) + (run-hooks 'tide-post-code-edit-hook)))))) + +(defun tide-get-flycheck-errors-ids-at-point () + (-map #'flycheck-error-id (flycheck-overlay-errors-at (point)))) + +(defun tide-command:getCodeFixes () + (tide-send-command-sync + "getCodeFixes" + `(:file ,(tide-buffer-file-name) + :startLine ,(tide-line-number-at-pos) :startOffset ,(tide-current-offset) + :endLine ,(tide-line-number-at-pos) :endOffset ,(+ 1 (tide-current-offset)) + :errorCodes ,(vconcat (tide-get-flycheck-errors-ids-at-point))))) + +(defun tide-command:getCombinedCodeFix (fixId) + (tide-send-command-sync "getCombinedCodeFix" + `(:scope (:type "file" :args (:file ,(tide-buffer-file-name))) :fixId ,fixId))) + +(defun tide-get-fix-description (fix) + (plist-get fix :description)) + +(defun tide-apply-codefix (fix) + "Apply a single `FIX', which may apply to several files." + (tide-apply-code-edits (plist-get fix :changes))) + +(defun tide-apply-codefix-for-all-in-file (fix) + (tide-apply-codefix fix) + (-when-let* ((fix-id (plist-get fix :fixId)) + (response (tide-command:getCombinedCodeFix fix-id))) + (tide-on-response-success response + (tide-apply-codefix (plist-get response :body))))) + +(defun tide-apply-codefixes (fixes codefix-fn) + (cond ((= 0 (length fixes)) (message "No code-fixes available.")) + ((= 1 (length fixes)) (funcall codefix-fn (car fixes))) + (t (funcall + codefix-fn + (tide-select-item-from-list "Select fix: " fixes + #'tide-get-fix-description (tide-can-use-popup-p 'code-fix)))))) + +(defun tide-code-fix (codefix-fn) + (unless (tide-get-flycheck-errors-ids-at-point) + (error "No errors available at current point.")) + (let ((response (tide-command:getCodeFixes))) + (tide-on-response-success response + (let ((fixes (plist-get response :body))) + (tide-apply-codefixes fixes codefix-fn))))) + +(defun tide-fix (&optional arg) + "Apply code fix for the error at point. + +When invoked with a prefix arg, apply code fix for all the errors +in the file that are similar to the error at point." + (interactive "P") + (if arg + (tide-code-fix #'tide-apply-codefix-for-all-in-file) + (tide-code-fix #'tide-apply-codefix))) + +;;; Organize Imports + +(defun tide-command:organizeImports () + (tide-send-command-sync "organizeImports" `(:scope (:type "file" :args (:file ,(tide-buffer-file-name)))))) + +(defun tide-organize-imports () + "Organize imports in the file." + (interactive) + (let ((response (tide-command:organizeImports))) + (tide-on-response-success response (:min-version "2.8") + (-when-let (changes (plist-get response :body)) + (tide-apply-code-edits changes))))) + +;;; Refactor + +(defun tide-location-or-range () + (if (use-region-p) + (let ((start (region-beginning)) + (end (region-end))) + `(:startLine ,(tide-line-number-at-pos start) :startOffset ,(tide-offset start) + :endLine ,(tide-line-number-at-pos end) :endOffset ,(tide-offset end))) + `(:line ,(tide-line-number-at-pos) :offset ,(tide-current-offset)))) + +(defun tide-command:getEditsForRefactor (refactor action) + (tide-send-command-sync + "getEditsForRefactor" + (append `(:refactor ,refactor :action ,action :file ,(tide-buffer-file-name)) + (tide-location-or-range)))) + +(defun tide-command:getApplicableRefactors () + (tide-send-command-sync + "getApplicableRefactors" + (append `(:file ,(tide-buffer-file-name)) (tide-location-or-range)))) + +(defun tide-get-refactor-description (refactor) + (plist-get refactor :description)) + +(defun tide-select-refactor (applicable-refactor-infos) + (let ((available-refactors + (-mapcat + (lambda (applicable-refactor-info) + (-map (lambda (refactor-action-info) + `(:action ,(plist-get refactor-action-info :name) + :refactor ,(plist-get applicable-refactor-info :name) + :inlineable ,(plist-get applicable-refactor-info :inlineable) + :description ,(plist-get refactor-action-info :description))) + (plist-get applicable-refactor-info :actions))) + applicable-refactor-infos))) + (tide-select-item-from-list "Select refactor: " available-refactors + #'tide-get-refactor-description (tide-can-use-popup-p 'refactor)))) + +(defun tide-apply-refactor (selected) + (let ((response (tide-command:getEditsForRefactor (plist-get selected :refactor) (plist-get selected :action)))) + (tide-on-response-success response + (progn + (deactivate-mark) + (tide-apply-code-edits (tide-plist-get response :body :edits)) + (-when-let (rename-location (tide-plist-get response :body :renameLocation)) + (with-current-buffer (tide-get-file-buffer (tide-plist-get response :body :renameFilename)) + (tide-move-to-location rename-location) + (when (tide-can-rename-symbol-p) + (tide-rename-symbol)))))))) + +(defun tide-refactor () + "Refactor code at point or current region" + (interactive) + (let ((response (tide-command:getApplicableRefactors))) + (tide-on-response-success response (:min-version "2.4") + (-if-let (body (plist-get response :body)) + (tide-apply-refactor + (tide-select-refactor body)) + (message "No refactors available."))))) + +;;; Disable tslint warnings + +(defconst tide-tslint-disable-next-line-regexp + "\\s *//\\s *tslint\\s *:\\s *disable-next-line\\s *:\\(.*\\)" + "Regexp matching a tslint flag disabling rules on the next line.") + +(defun tide-add-tslint-disable-next-line () + "Add a tslint flag to disable rules generating errors at point. + +This function adds or modifies a flag of this form to the +previous line: + + // tslint:disable-next-line:[rule1] [rule2] [...] + +The line will be indented according to the current indentation +settings. This function generates rule1, rule2 to cover all the +errors present at point. + +If the previous line does not already contain a disable-next-line +flag, a new line is added to hold the new flag. If the previous +line already contains a disable-next-line flag, the rule is added +to the flag. Note that this function does not preserve the +formatting of the already existing flag. The resulting flag will +always be formatted as described above." + (interactive) + (let ((error-ids (delq nil (tide-get-flycheck-errors-ids-at-point))) + (start (point))) + (when error-ids + (save-excursion + (if (and (eq 0 (forward-line -1)) + (looking-at tide-tslint-disable-next-line-regexp)) + ;; We'll update the old flag. + (let ((old-list (split-string (match-string 1)))) + (delete-region (point) (point-at-eol)) + (setq error-ids (append old-list error-ids))) + ;; We'll create a new flag. + (goto-char start) + (beginning-of-line) + (open-line 1)) + (insert "// tslint:disable-next-line:" + (string-join error-ids " ")) + (typescript-indent-line))))) + +;;; Disable Eslint Warnings + +(defconst tide-eslint-disable-next-line-regexp + "\\s *//\\s *eslint-disable-next-line\\s *\\(.*\\)") + +(defun tide-add-eslint-disable-next-line () + "Add a eslint flag to disable rules generating errors at point. + +This function adds or modifies a flag of this form to the +previous line: + + // eslint-disable-next-line [rule1], [rule2], [...] + +The line will be indented according to the current indentation +settings. This function generates rule1, rule2 to cover all the +errors present at point. + +If the previous line does not already contain a disable-next-line +flag, a new line is added to hold the new flag. If the previous +line already contains a disable-next-line flag, the rule is added +to the flag. Note that this function does not preserve the +formatting of the already existing flag. The resulting flag will +always be formatted as described above." + (interactive) + (let ((error-ids (delq nil (tide-get-flycheck-errors-ids-at-point))) + (start (point))) + (when error-ids + (save-excursion + (if (and (eq 0 (forward-line -1)) + (looking-at tide-eslint-disable-next-line-regexp)) + ;; We'll update the old flag. + (let ((old-list (split-string (match-string 1) "\,[\s]+"))) + (delete-region (point) (point-at-eol)) + (setq error-ids (append old-list error-ids))) + ;; We'll create a new flag. + (goto-char start) + (beginning-of-line) + (open-line 1)) + (insert "// eslint-disable-next-line " + (string-join error-ids ", ")) + (typescript-indent-line))))) + +;;; Auto completion + +(defun tide-completion-annotation (name) + (-if-let (meta (and tide-completion-detailed (tide-completion-meta name))) + ;; Get everything before the first newline, if any, because company-mode + ;; wants single-line annotations. + (car (split-string meta "\n")) + (if tide-completion-show-source + (tide-completion-append-source (tide-completion-annotation-trans-mark name) name nil) + (tide-completion-annotation-trans-mark name)))) + +(defun tide-completion-annotation-trans-mark (name) + (pcase (plist-get (get-text-property 0 'completion name) :kind) + ("keyword" " k") + ("module" " M") + ("class" " C") + ("interface" " I") + ("type" " T") + ("enum" " E") + ("var" " v") + ("local var" " v") + ("function" " ƒ") + ("local function" " ƒ") + ("method" " m") + ("getter" " m") + ("setter" " m") + ("property" " p") + ("constructor" " c") + ("call" " m") + ("index" " i") + ("construct" " m") + ("parameter" " p") + ("type parameter" " T") + ("primitive type" " T") + ("label" " l") + ("alias" " A") + ("const" " c") + ("let" " l") + (_ nil))) + +(defun tide-completion-kind (name) + (pcase (plist-get (get-text-property 0 'completion name) :kind) + ((or "primitive type" "keyword") 'keyword) + ((or "const" "let" "var" "local var" "alias" "parameter") 'variable) + ((or "property" "getter" "setter") 'field) + ((or "function" "local function") 'function) + ((or "method" "construct" "call" "index") 'method) + ("enum" 'enum) + ("enum member" 'enum-member) + ((or "module" "external module name") 'module) + ((or "class" "type") 'class) + ("interface" 'interface) + ("warning" 'text) + ("script" 'file) + ("directory" 'folder) + ("string" 'constant) + (_ 'property))) + +(defun tide-completion-rank (completion) + "Get the sorting order of a COMPLETION candidate." + (or + (-elem-index + (plist-get completion :kind) + '("parameter" + "local function" + "local var" + "let" + "var" + "const" + "function" + "class" + "method" + "getter" + "setter" + )) + 100)) + +(defun tide-compose-comparators (cmp1 cmp2) + "A helper function that composes two comparators CMP1 and CMP2." + (lambda (a b) + (cond ((funcall cmp1 a b) t) + ((funcall cmp1 b a) nil) + (t (funcall cmp2 a b))))) + +(defun tide-compare-completions-basic (completion-a completion-b) + "Compare COMPLETION-A and COMPLETION-B based on their `sortText' property. +This function is used for the basic completions sorting." + (let ((sort-text-a (plist-get completion-a :sortText)) + (sort-text-b (plist-get completion-b :sortText))) + (string< sort-text-a sort-text-b))) + +(defun tide-compare-completions-by-kind (completion-a completion-b) + "Compare COMPLETION-A and COMPLETION-B based on their kind." + (let ((modifier-a (plist-get completion-a :kindModifiers)) + (modifier-b (plist-get completion-b :kindModifiers))) + (if (string-equal modifier-a modifier-b) + (< (tide-completion-rank completion-a) (tide-completion-rank completion-b)) + ;; Rank declarations lower than variables + (string-equal modifier-b "declare")))) + +(defun tide-completion-prefix () + (if (and (tide-in-string-p) + (looking-back + (rx (or (and "import" (1+ space) (or ?\" ?') (0+ (not (any ?\" ?')))) + (and "from" (1+ space) (or ?\" ?') (0+ (not (any ?\" ?')))) + (and "import(" (or ?\" ?') (0+ (not (any ?\" ?')))) + (and "require(" (or ?\" ?') (0+ (not (any ?\" ?')))))) + nil)) + (cons (company-grab (rx (or ?/ ?\" ?') (group (0+ (not (any ?\" ?'))))) 1) t) + (company-grab-symbol-cons "\\." 1))) + +(defun tide-member-completion-p (prefix) + (save-excursion + (backward-char (length prefix)) + (and (> (point) (point-min)) + (equal (string (char-before (point))) ".")))) + +(defun tide-completion-filter-candidates (completions prefix) + (-filter (lambda (completion) + (and + (if tide-completion-fuzzy + (let ((case-fold-search tide-completion-ignore-case)) + (string-match-p (regexp-quote prefix) (plist-get completion :name))) + (string-prefix-p prefix (plist-get completion :name) tide-completion-ignore-case)) + (or (not tide-filter-out-warning-completions) + (not (equal (plist-get completion :kind) "warning"))))) + completions)) + +(defun tide-annotate-completions (completions prefix file-location) + (-map + (lambda (completion) + (let ((name (plist-get completion :name))) + (put-text-property 0 1 'file-location file-location name) + (put-text-property 0 1 'completion completion name) + (put-text-property 0 1 'prefix prefix name) + name)) + (let ((filtered (tide-completion-filter-candidates completions prefix))) + (let ((completions-comparator + (if tide-sort-completions-by-kind + (tide-compose-comparators 'tide-compare-completions-basic + 'tide-compare-completions-by-kind) + 'tide-compare-completions-basic))) + (-sort completions-comparator filtered))))) + +(defun tide-command:completions (prefix cb) + (let ((file-location + `(:file ,(tide-buffer-file-name) + :line ,(tide-line-number-at-pos) :offset ,(- (tide-current-offset) (length prefix)) + :includeExternalModuleExports ,tide-completion-enable-autoimport-suggestions + :includeInsertTextCompletions t))) + (when (and (not (tide-in-string-p)) (not (tide-member-completion-p prefix))) + (setq file-location (-concat file-location `(:prefix ,prefix)))) + (tide-send-command + "completions" + file-location + (lambda (response) + (funcall + cb + (when (tide-response-success-p response) + (tide-annotate-completions (plist-get response :body) prefix file-location))))))) + +(defun tide-command:completionEntryDetails (name) + (let* ((source (plist-get (get-text-property 0 'completion name) :source)) + (entry-names (if source + `(:entryNames [(:name ,name :source ,source)]) + `(:entryNames [,name]))) + (arguments (-concat (get-text-property 0 'file-location name) + entry-names))) + (-when-let (response (tide-send-command-sync "completionEntryDetails" arguments)) + (when (tide-response-success-p response) + response)))) + +(defun tide-completion-entry-details (name) + (-if-let (detail-response (get-text-property 0 'completion-detail name)) + detail-response + (let ((detail-response (tide-command:completionEntryDetails name))) + (put-text-property 0 1 'completion-detail detail-response name) + detail-response))) + +(defun tide-completion-meta (name) + (-when-let* ((response (tide-completion-entry-details name)) + (detail (car (plist-get response :body)))) + (tide-completion-append-source (tide-doc-text detail) name t))) + +(defun tide-completion-append-source (text name detailed) + (if detailed + (-if-let* ((response (tide-completion-entry-details name)) + (detail (car (plist-get response :body))) + (raw-source (plist-get detail :source))) + (tide-join (list text " " (tide-normalize-source (tide-annotate-display-parts raw-source)))) + text) + (-if-let* ((completion (get-text-property 0 'completion name)) + (raw-source (plist-get completion :source))) + (tide-join (list text " " (tide-normalize-source raw-source))) + text))) + +(defun tide-normalize-source (source) + "Normalize tsserver returned source: + +1. Transform to relative path +2. Cleanup path components before last `/node_modules/` +3. Cleanup `/index` if it is the last path component +4. Transform `@types/namespace__pkgname` to `@namespace/pkgname`" + (--> source + + (if (file-name-absolute-p it) + (file-relative-name it (buffer-file-name)) + it) + + (if (s-contains? "/node_modules/" it) + (->> it + (s-split "/node_modules/") + (-last-item)) + it) + + (s-chop-suffix "/index" it) + + (if (s-starts-with? "@types/" it) + (-as-> (s-chop-prefix "@types/" it) itt + (if (s-contains? "__" itt) + (->> itt + (s-replace "__" "/") + (s-concat "@")) + itt)) + it))) + +(defun tide-completion-doc-buffer (name) + (-when-let* ((response (tide-completion-entry-details name)) + (detail (car (plist-get response :body)))) + (tide-make-help-buffer "documentation" (tide-construct-documentation detail)))) + +(defun tide-post-completion (name) + (let ((completion (get-text-property 0 'completion name)) + (prefix (get-text-property 0 'prefix name))) + + (-when-let (insert-text (plist-get completion :insertText)) + (when (looking-back (rx-to-string name) nil) + (backward-delete-char (length name)) + (-if-let (span (plist-get completion :replacementSpan)) + (progn + (when (string-prefix-p prefix (plist-get completion :name) tide-completion-ignore-case) + (insert prefix)) ;; tsserver assumes the prefix text is already inserted for non-fuzzy completion. + (tide-apply-edit (tide-combine-plists span `(:newText ,insert-text)))) + (insert insert-text)))) + + (-when-let* ((has-action (plist-get completion :hasAction)) + (response (tide-completion-entry-details name)) + (detail (car (plist-get response :body))) + (fixes (plist-get detail :codeActions))) + (tide-apply-codefixes fixes #'tide-apply-codefix)))) + +;;;###autoload +(defun company-tide (command &optional arg &rest ignored) + (interactive (list 'interactive)) + (cl-case command + ((interactive) (company-begin-backend 'company-tide)) + ((prefix) (and + (bound-and-true-p tide-mode) + (-any-p #'derived-mode-p tide-supported-modes) + (tide-current-server) + (not (nth 4 (syntax-ppss))) + (or (tide-completion-prefix) 'stop))) + ((candidates) (cons :async (lambda (cb) (tide-command:completions arg cb)))) + ((sorted) t) + ((no-cache) tide-completion-fuzzy) + ((ignore-case) tide-completion-ignore-case) + ((meta) (tide-completion-meta arg)) + ((match) + (let* ((completion (get-text-property 0 'completion arg)) + (prefix (get-text-property 0 'prefix arg)) + (start (if tide-completion-fuzzy + (let ((case-fold-search tide-completion-ignore-case)) + (string-match-p (regexp-quote prefix) (plist-get completion :name))) + 0))) + `((,start . ,(+ start (length prefix)))))) + ((annotation) (tide-completion-annotation arg)) + ((kind) (tide-completion-kind arg)) + ((doc-buffer) (tide-completion-doc-buffer arg)) + ((post-completion) (tide-post-completion arg)) + ((pre-render) (let ((name arg) + (annotation-p (car ignored))) + (if (and (not annotation-p) + (s-contains? "deprecated" + (or (plist-get (get-text-property 0 'completion name) :kindModifiers) + ""))) + (propertize name 'face '(:strike-through t)) + name))))) + +(with-eval-after-load 'company + (when tide-completion-setup-company-backend + (cl-pushnew 'company-tide company-backends))) + +;;; References + +(defun tide--next-reference (pos arg &optional cyclep) + "Move to the ARG-th next reference from pos, negative values go to previous +ones. Cycle around if CYCLEP is non-nil." + (let* ((nextp (>= arg 0)) + (next (if nextp #'next-single-property-change #'previous-single-property-change)) + (n (* 2 (abs arg)))) + (when (get-text-property pos 'tide-reference) + (setq pos (or (funcall next pos 'tide-reference) pos))) + (when (or nextp (and (> pos (point-min)) + (get-text-property (1- pos) 'tide-reference))) + (setq n (1- n))) + (dotimes (_i n) + (setq pos (funcall next pos 'tide-reference)) + (unless pos + (unless cyclep + (error "Moved %s reference" (if nextp "past last" "before first"))) + (setq pos (funcall next (if nextp (point-min) (point-max)) + 'tide-reference)))) + (goto-char pos))) + +(defun tide-next-reference-function (n &optional reset) + "Override for `next-error-function' for use in tide-reference-mode buffers." + (interactive "p") + (-when-let (buffer (get-buffer "*tide-references*")) + (with-current-buffer buffer + (when reset (goto-char (point-min))) + (tide--next-reference (point) (or n 1)) + (-when-let (window (get-buffer-window buffer)) + ;; actually move to the point if the refs are shown + (set-window-point window (point))) + (tide-goto-reference)))) + +(defun tide-find-next-reference (pos arg) + "Move to next reference." + (interactive "d\np") + (tide--next-reference pos arg)) +(defun tide-cycle-next-reference (pos arg) + "Move to next reference, cycling back when reaching the last. +Move back when used from a shifted key binding." + (interactive "d\np") + (tide--next-reference pos arg t)) +(defun tide-find-previous-reference (pos arg) + "Move back to previous reference." + (interactive "d\np") + (tide--next-reference pos (- arg))) +(defun tide-cycle-previous-reference (pos arg) + (interactive "d\np") + (tide--next-reference pos (- arg) t)) + +(defun tide-goto-reference () + "Jump to reference location in the file." + (interactive) + (-when-let (reference (get-text-property (point) 'tide-reference)) + (tide-jump-to-filespan reference nil t))) + +(defun tide-goto-line-reference () + "Jump to the corresponding location in the referenced file." + (interactive) + (-when-let* ((ref (get-text-property (point) 'tide-line-reference)) + (col (- (point) (line-beginning-position)))) + (tide-jump-to-filespan ref nil t) + (goto-char (+ (line-beginning-position) col)))) + +(defvar tide-references-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "n") #'tide-find-next-reference) + (define-key map (kbd "p") #'tide-find-previous-reference) + (define-key map (kbd "TAB") #'tide-cycle-next-reference) + (define-key map (kbd "") #'tide-cycle-previous-reference) + (define-key map (kbd "RET") #'tide-goto-line-reference) + (define-key map [mouse-1] #'tide-goto-reference) + ;; taken from grep.el + (define-key map (kbd "SPC") #'scroll-up-command) + (define-key map (kbd "S-SPC") #'scroll-down-command) + (define-key map (kbd "DEL") #'scroll-down-command) + map)) + +(define-derived-mode tide-references-mode special-mode "tide-references" + "Major mode for tide references list. + +\\{tide-references-mode-map}" + (setq next-error-function #'tide-next-reference-function)) + +(defun tide-command:references (&optional location) + (let ((location (or location + `(:file ,(tide-buffer-file-name) + :line ,(tide-line-number-at-pos) + :offset ,(tide-current-offset))))) + (tide-send-command-sync + "references" + location))) + +(defun tide-insert-references (references) + "Create a buffer with the given REFERENCES. + +Assumes references are grouped by file name and sorted by line +number." + (let* ((buffer (get-buffer-create "*tide-references*")) + (inhibit-read-only t) + (width tab-width) + (project-root (tide-project-root)) + (last-file-name nil) + (prefix-len (length (number-to-string + (--reduce (max acc (tide-plist-get it :start :line)) + (cons 0 references))))) + (linenum-fmt (format "%%%dd" prefix-len)) + (wrap-prefix (make-string prefix-len ?\ ))) + (with-current-buffer buffer + (erase-buffer) + (tide-references-mode) + (setq-local tab-width width) + (while references + (let* ((reference (car references)) + (full-file-name (plist-get reference :file)) + (file-name (file-relative-name full-file-name project-root)) + (line-number (tide-plist-get reference :start :line)) + (line-text (concat (plist-get reference :lineText) "\n")) + (line-prefix (concat (propertize (format linenum-fmt line-number) + 'face 'tide-line-number) + ": "))) + ;; file + (unless (equal last-file-name file-name) + (setq last-file-name file-name) + (insert (propertize "\n" 'line-prefix (propertize file-name 'face 'tide-file)))) + ;; line text + (while (and references + (equal full-file-name (plist-get (car references) :file)) + (equal line-number (tide-plist-get (car references) :start :line))) + (let* ((reference (pop references)) + (start (1- (tide-plist-get reference :start :offset))) + (end (1- (tide-plist-get reference :end :offset)))) + (dolist (p `((tide-reference ,reference) + (face tide-match) + (mouse-face highlight) + (help-echo "mouse-1: Visit the reference."))) + (put-text-property start end (car p) (cadr p) line-text)))) + (insert (propertize line-text 'line-prefix line-prefix 'wrap-prefix wrap-prefix + 'tide-line-reference reference)))) + (goto-char (point-min)) + (forward-line 1) + (set-buffer-modified-p nil) + (current-buffer)))) + +(defun tide-is-identical-reference (original second) + (and (equal (plist-get original :file) (plist-get second :file)) + (eq (tide-plist-get original :start :line) (tide-plist-get second :start :line)))) +(defun tide-find-single-usage (references) + (let ((definition nil) + (usage nil) + (multiple nil)) + (-each references + #'(lambda (reference) + (if (eq t (plist-get reference :isDefinition)) + (if (or (eq definition nil) (tide-is-identical-reference definition reference)) + (setq definition reference) + (setq multiple t)) + (if (or (eq usage nil) (tide-is-identical-reference usage reference)) + (setq usage reference) + (setq multiple t))))) + (and (not multiple) definition usage))) + +(defun tide-references () + "List all references to the symbol at point." + (interactive) + (let ((response (tide-command:references))) + (tide-on-response-success response + (let ((references (tide-plist-get response :body :refs))) + (-if-let (usage (tide-find-single-usage references)) + (progn + (message "This is the only usage.") + (tide-jump-to-filespan usage nil t)) + (display-buffer (tide-insert-references references))))))) + + +;;; Imenu + +(defun tide-build-flat-imenu-index (navtree &optional parent) + (let* ((child-items (plist-get navtree :childItems)) + (text (plist-get navtree :text)) + (new-text (if parent (concat parent imenu-level-separator text) text)) + (node (cons (concat new-text " " (propertize (plist-get navtree :kind) 'face 'tide-imenu-type-face)) + (tide-span-to-position (plist-get (car (plist-get navtree :spans)) :start))))) + (if child-items + (-concat (list node) (-flatten (-map (lambda (i) (tide-build-flat-imenu-index i new-text)) child-items))) + (list node)))) + +(defun tide-build-imenu-index (navtree) + (let* ((child-items (plist-get navtree :childItems)) + (text (plist-get navtree :text)) + (node (cons (concat text " " (propertize (plist-get navtree :kind) 'face 'tide-imenu-type-face)) + (tide-span-to-position (plist-get (car (plist-get navtree :spans)) :start))))) + (if child-items + (cons text + (-concat (list node) + (-map #'tide-build-imenu-index child-items))) + node))) + +(defun tide-command:navbar () + (tide-send-command-sync "navtree" `(:file ,(tide-buffer-file-name)))) + +(defun tide-imenu-index () + (let ((response (tide-command:navbar))) + (tide-on-response-success response + (let ((children (tide-plist-get response :body :childItems))) + (if tide-imenu-flatten + (-flatten (-map #'tide-build-flat-imenu-index children)) + (mapcar #'tide-build-imenu-index children)))))) + +;;; Rename + +(defun tide-command:rename () + (tide-send-command-sync "rename" + `(:file ,(tide-buffer-file-name) + :line ,(tide-line-number-at-pos) :offset ,(tide-current-offset)))) + +(defun tide-rename-symbol-at-location (location new-symbol) + (let ((file (plist-get location :file))) + (save-excursion + (with-current-buffer (tide-get-file-buffer file) + (-each + (-map (lambda (filespan) + (tide-move-to-location (plist-get filespan :start)) + (cons (point-marker) filespan)) + (plist-get location :locs)) + (lambda (pointer) + (let* ((marker (car pointer)) + (filespan (cdr pointer))) + (goto-char marker) + (delete-char (- (tide-plist-get filespan :end :offset) (tide-plist-get filespan :start :offset))) + (insert new-symbol)))) + ;; Saving won't work if the current buffer is temporary or an indirect + ;; buffer + (when (equal buffer-file-name file) + (basic-save-buffer)) + (length (plist-get location :locs)))))) + +(defun tide-read-new-symbol (old-symbol) + (let ((new-symbol (read-from-minibuffer (format "Rename %s to: " old-symbol) old-symbol))) + (if (string-match-p "\\`[ \t\n\r]*\\'" new-symbol) + (error "Invalid name") + new-symbol))) + +(defun tide-can-rename-symbol-p () + (let ((response (tide-command:rename))) + (and + (tide-response-success-p response) + (eq (tide-plist-get response :body :info :canRename) t)))) + +(defun tide-rename-symbol () + "Rename symbol at point." + (interactive) + (let ((response (tide-command:rename))) + (tide-on-response-success response + (if (eq (tide-plist-get response :body :info :canRename) :json-false) + (message "%s" (tide-plist-get response :body :info :localizedErrorMessage)) + (let* ((old-symbol (tide-plist-get response :body :info :displayName)) + (new-symbol (tide-read-new-symbol old-symbol)) + (locs (tide-plist-get response :body :locs)) + (count 0) + (current-file-p + (lambda (loc) + (file-equal-p (expand-file-name (tide-buffer-file-name)) + (plist-get loc :file))))) + + ;; Saving current file will trigger a compilation + ;; check. So make sure all the other files are saved + ;; before saving current file. + + (-each (nconc (-reject current-file-p locs) + (-select current-file-p locs)) + (lambda (loc) + (cl-incf count (tide-rename-symbol-at-location loc new-symbol)))) + + (message "Renamed %d occurrences." count)))))) + +(defun tide-command:getEditsForFileRename (old new) + (tide-send-command-sync "getEditsForFileRename" `(:oldFilePath ,old :newFilePath ,new :file ,old))) + +(defun tide-do-rename-file (old new edits) + (let* ((code-edit-for-old-p (lambda (code-edit) (string= (plist-get code-edit :fileName) old))) + (before-rename-edits (-select code-edit-for-old-p edits)) + (after-rename-edits (-reject code-edit-for-old-p edits))) + (tide-apply-code-edits before-rename-edits) + (tide-cleanup-buffer) + (mkdir (file-name-directory new) t) + (rename-file old new) + (rename-buffer (file-name-nondirectory new) t) + (set-visited-file-name new) + (set-buffer-modified-p nil) + (tide-apply-code-edits after-rename-edits) + (revert-buffer t t t))) + +(defun tide-rename-file () + "Rename current file and all it's references in other files." + (interactive) + (let* ((name (buffer-name)) + (old (tide-buffer-file-name)) + (basename (file-name-nondirectory old))) + (unless (and old (file-exists-p old)) + (error "Buffer '%s' is not visiting a file." name)) + (let ((new (read-file-name "New name: " (file-name-directory old) basename nil basename))) + (when (get-file-buffer new) + (error "A buffer named '%s' already exists." new)) + (when (file-exists-p new) + (error "A file named '%s' already exists." new)) + (let* ((old (expand-file-name old)) + (new (expand-file-name new)) + (response (tide-command:getEditsForFileRename old new))) + (tide-on-response-success response (:min-version "2.9") + (tide-do-rename-file old new (plist-get response :body)) + (message "Renamed '%s' to '%s'." name (file-name-nondirectory new))))))) + +;;; Format + +;;;###autoload +(defun tide-format-before-save () + "Before save hook to format the buffer before each save." + (interactive) + (when (bound-and-true-p tide-mode) + (tide-format))) + +;;;###autoload +(defun tide-format () + "Format the current region or buffer." + (interactive) + (if (use-region-p) + (tide-format-region (region-beginning) (region-end)) + (tide-format-region (point-min) (point-max)))) + +(defun tide-normalize-lineshift (str) + "Reformat `STR' to only contain line-shift formats expected by Emacs. + +When inserting text in an Emacs-buffer Emacs only ever expects \n +for newlines, no matter what the actual encoding of the file +is. Inserting anything else causes issues with formatting and +code-analysis." + + ;; convert DOS CR+LF to LF + (setq str (replace-regexp-in-string "\r\n" "\n" str)) + ;; convert Mac CR to LF + (setq str (subst-char-in-string ?\r ?\n str)) + str) + +(defun tide-insert (str) + "Insert `STR' into the buffer, but normalize the line-enings." + + (insert (tide-normalize-lineshift str))) + +(defun tide-apply-edit (edit) + (goto-char (tide-location-to-point (plist-get edit :start))) + (delete-region (point) (tide-location-to-point (plist-get edit :end))) + (let ((start (point-marker))) + (tide-insert (plist-get edit :newText)) + (cons start (point-marker)))) + +(defun tide-do-apply-edits (edits) + (save-excursion + (-map (lambda (edit) (tide-apply-edit edit)) + (nreverse edits)))) + +(defun tide-apply-edits (edits) + (if (and (fboundp 'combine-change-calls) + (> (length edits) 2)) + (combine-change-calls (point-min) (point-max) (tide-do-apply-edits edits)) + (tide-do-apply-edits edits))) + +(defun tide-format-region (start end) + (let ((response (tide-send-command-sync + "format" + `(:file ,(tide-buffer-file-name) + :line ,(tide-line-number-at-pos start) + :offset ,(tide-offset start) + :endLine ,(tide-line-number-at-pos end) + :endOffset ,(tide-offset end))))) + (tide-on-response-success response + (tide-apply-edits (plist-get response :body))))) + +(defun tide-format-regions (ranges) + (let ((positions (->> + ranges + (-mapcat (lambda (range) (list (marker-position (car range)) (marker-position (cdr range))))) + (-sort '<)))) + (tide-format-region (-min positions) (-max positions)))) + +;;; JSDoc Comment Template + +(defun tide-command:docCommentTemplate () + (tide-send-command-sync "docCommentTemplate" + `(:file ,buffer-file-name + :line ,(tide-line-number-at-pos) :offset ,(tide-current-offset)))) + +(defun tide-jsdoc-template () + "Insert JSDoc comment template at point" + (interactive) + (let ((response (tide-command:docCommentTemplate))) + (tide-on-response-success response + (progn + (save-excursion + (tide-insert (tide-plist-get response :body :newText))) + (forward-char (tide-plist-get response :body :caretOffset)))))) + +;;; Mode + +(defvar tide-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "M-.") #'tide-jump-to-definition) + (define-key map (kbd "M-,") #'tide-jump-back) + map)) + +(defun tide-configure-buffer () + (setq tide-active-buffer-file-name (tide-buffer-file-name)) + + (tide-command:openfile) + (tide-command:configure) + + ;; tsserver requires non-.ts files to be manually added to the files array in + ;; tsconfig.json, otherwise the file will be loaded as part of an 'inferred + ;; project'. This won't be necessary anymore after TypeScript allows defining + ;; custom file extensions. https://github.com/Microsoft/TypeScript/issues/8328 + (when (and tide-require-manual-setup (tide-buffer-file-name)) + (tide-command:projectInfo + (lambda (response) + (tide-on-response-success response + (when (string-prefix-p "/dev/null/inferredProject" + (tide-plist-get response :body :configFileName)) + (message (format "'%s' is not part of a project, add it to the files array in tsconfig.json" + (tide-buffer-file-name))))))))) + +(defun tide-configure-buffer-if-server-exists () + "Invoke `tide-configure-buffer' only if there is a server running for the +current buffer." + (when (tide-current-server) + (tide-configure-buffer))) + +(defun tide-cleanup-buffer () + (ignore-errors + (tide-command:closefile)) + (ignore-errors + (tide-remove-tmp-file))) + +;;;###autoload +(defun tide-setup () + "Setup `tide-mode' in current buffer." + (interactive) + + (when (version< emacs-version tide--minimal-emacs) + (display-warning 'tide (format "Tide requires Emacs >= %s, you are using %s." + tide--minimal-emacs emacs-version) + :error)) + + ;; Indirect buffers embedded in other major modes such as those in org-mode or + ;; template languages have to be manually synchronized to tsserver. This might + ;; cause problems in files with lots of small blocks of TypeScript. In that + ;; case we should either add an ignore list or don't do anything at all when + ;; there are more than a certain amount of snippets. + (unless (stringp buffer-file-name) + (setq tide-require-manual-setup t)) + + (set (make-local-variable 'eldoc-documentation-function) + 'tide-eldoc-function) + (set (make-local-variable 'imenu-auto-rescan) t) + (set (make-local-variable 'imenu-create-index-function) + 'tide-imenu-index) + + (tide-mode 1) + + (if (tide-current-server) + ;; + ;; We want to issue tide-configure-buffer here if the server exists. We + ;; cannot rely on hack-local-variable-hook in tide-mode because the hook + ;; may not run at all, or run too late. + ;; + ;; It may happen for some use-case scenarios that tide-configure-buffer + ;; runs more than once with the same data for the same buffer, but that's + ;; not a big deal. + ;; + (tide-configure-buffer) + (when (eq tide-tsserver-start-method 'immediate) + (tide-start-server)))) + +;;;###autoload +(define-minor-mode tide-mode + "Minor mode for Typescript Interactive Development Environment. + +\\{tide-mode-map}" + :lighter " tide" + :keymap tide-mode-map + (if tide-mode + (progn + (add-hook 'after-save-hook 'tide-sync-buffer-contents nil t) + (add-hook 'after-save-hook 'tide-auto-compile-file nil t) + (add-hook 'after-change-functions 'tide-handle-change nil t) + (add-hook 'kill-buffer-hook 'tide-cleanup-buffer nil t) + (add-hook 'kill-buffer-hook 'tide-schedule-dead-projects-cleanup nil t) + (add-hook 'hack-local-variables-hook + 'tide-configure-buffer-if-server-exists nil t) + (when tide-enable-xref + (add-hook 'xref-backend-functions #'xref-tide-xref-backend nil t)) + (when (commandp 'typescript-insert-and-indent) + (eldoc-add-command 'typescript-insert-and-indent))) + (remove-hook 'after-save-hook 'tide-sync-buffer-contents t) + (remove-hook 'after-save-hook 'tide-auto-compile-file t) + (remove-hook 'after-change-functions 'tide-handle-change t) + (remove-hook 'kill-buffer-hook 'tide-cleanup-buffer t) + (remove-hook 'kill-buffer-hook 'tide-schedule-dead-projects-cleanup t) + (remove-hook 'hack-local-variables-hook + 'tide-configure-buffer-if-server-exists t) + (remove-hook 'xref-backend-functions #'xref-tide-xref-backend t) + (tide-cleanup-buffer))) + + +;;; Error highlighting + +(defun tide-command:geterr (cb) + (let* ((result '()) + (resolved nil) + (err nil)) + (cl-flet ((resolve () + (cond (resolved nil) + (err (setq resolved t) + (funcall cb err)) + ((and (plist-member result :syntaxDiag) + (plist-member result :semanticDiag) + (plist-member result :suggestionDiag)) + (setq resolved t) + (funcall cb `(:body (,result) :success t)))))) + (tide-send-command + "syntacticDiagnosticsSync" + `(:file ,(tide-buffer-file-name)) + (lambda (response) + (if (tide-response-success-p response) + (setq result (plist-put result :syntaxDiag (plist-get response :body))) + (setq err response)) + (resolve))) + (tide-send-command + "semanticDiagnosticsSync" + `(:file ,(tide-buffer-file-name)) + (lambda (response) + (if (tide-response-success-p response) + (setq result (plist-put result :semanticDiag (plist-get response :body))) + (setq err response)) + (resolve))) + + (if tide-disable-suggestions + (setq result (plist-put result :suggestionDiag '())) + (tide-send-command + "suggestionDiagnosticsSync" + `(:file ,(tide-buffer-file-name)) + (lambda (response) + (cond + ((tide-response-success-p response) + (setq result (plist-put result :suggestionDiag (plist-get response :body)))) + ((tide-command-unknown-p response) + (setq result (plist-put result :suggestionDiag '()))) + (t (setq err response))) + (resolve))))))) + +(defun tide-parse-error (response checker) + (-map + (lambda (diagnostic) + (let* ((start (plist-get diagnostic :start)) + (line (plist-get start :line)) + (column (plist-get start :offset)) + (level (if (string= (plist-get diagnostic :category) "suggestion") 'info 'error)) + (text (plist-get diagnostic :text))) + (when (plist-get diagnostic :relatedInformation) + (setq text (concat text (propertize " ⮐" 'face 'font-lock-warning-face)))) + (put-text-property 0 1 'diagnostic diagnostic text) + (flycheck-error-new-at line column level text + :checker checker + :id (plist-get diagnostic :code)))) + (let ((diagnostic (car (tide-plist-get response :body)))) + (-concat (plist-get diagnostic :syntaxDiag) + (plist-get diagnostic :semanticDiag) + (plist-get diagnostic :suggestionDiag))))) + +(defun tide-flycheck-send-response (callback checker response) + (condition-case err + (funcall callback 'finished (tide-parse-error response checker)) + (error (funcall callback 'errored (error-message-string err))))) + +(defun tide-flycheck-start (checker callback) + (tide-command:geterr + (lambda (response) + (when (tide-command-unknown-p response) + (tide-tsserver-version-not-supported)) + (if (tide-response-success-p response) + (tide-flycheck-send-response callback checker response) + (funcall callback 'errored (plist-get response :message)))))) + +(defun tide-make-clickable-filespan (filespan) + (propertize + (concat + (file-name-nondirectory (plist-get filespan :file)) + ":" + (number-to-string (tide-plist-get filespan :start :line))) + 'face 'link + 'help-echo "mouse-2: go to this location" + 'keymap (let ((map (make-sparse-keymap))) + (define-key map [mouse-2] 'tide-goto-error) + (define-key map [mouse-1] 'tide-goto-error) + (define-key map (kbd "RET") 'tide-goto-error) + (define-key map [follow-link] 'mouse-face) + map) + 'tide-error filespan)) + +(defun tide-format-related-information (related) + (concat + (tide-make-clickable-filespan (plist-get related :span)) + " " + (plist-get related :message) + " [" (number-to-string (plist-get related :code)) "]")) + +(defun tide-explain-error (err) + (let* ((diagnostic (get-text-property 0 'diagnostic (flycheck-error-message err))) + (related (plist-get diagnostic :relatedInformation))) + (concat + (propertize "Code: " 'face 'bold) (number-to-string (plist-get diagnostic :code)) " " + (propertize "Category: " 'face 'bold) (plist-get diagnostic :category) + "\n\n" + (plist-get diagnostic :text) + "\n\n" + (when related + (concat + (propertize "Related Information: \n\n" 'face 'bold) + (mapconcat 'tide-format-related-information related "\n\n")))))) + +(defun tide-error-at-point () + "Show the details of the error at point." + (interactive) + (-if-let (errors (flycheck-overlay-errors-at (point))) + (tide-display-help-buffer "error" + (mapconcat #'tide-explain-error errors "\n\n--------\n\n")) + (message "No errors available."))) + +(defun tide-flycheck-verify (_checker) + (list + (flycheck-verification-result-new + :label "Typescript server" + :message (if (tide-current-server) "running" "not running") + :face (if (tide-current-server) 'success '(bold error))) + (flycheck-verification-result-new + :label "Tide mode" + :message (if (bound-and-true-p tide-mode) "enabled" "disabled") + :face (if (bound-and-true-p tide-mode) 'success '(bold warning))))) + +(defun tide-flycheck-predicate () + (and (bound-and-true-p tide-mode) + (tide-current-server) + (not (file-equal-p (tide-project-root) tide-tsserver-directory)))) + +(defun tide-file-extension-p (ext) + (and buffer-file-name + (string-equal ext (file-name-extension buffer-file-name)))) + +(flycheck-define-generic-checker 'typescript-tide + "A TypeScript syntax checker using tsserver." + :start #'tide-flycheck-start + :verify #'tide-flycheck-verify + :modes '(typescript-mode) + :predicate #'tide-flycheck-predicate) + +(add-to-list 'flycheck-checkers 'typescript-tide) + +(flycheck-define-generic-checker 'javascript-tide + "A Javascript syntax checker using tsserver." + :start #'tide-flycheck-start + :verify #'tide-flycheck-verify + :modes '(js-mode js2-mode js3-mode) + :predicate #'tide-flycheck-predicate) + +(add-to-list 'flycheck-checkers 'javascript-tide t) + +(flycheck-define-generic-checker 'jsx-tide + "A JSX syntax checker using tsserver." + :start #'tide-flycheck-start + :verify #'tide-flycheck-verify + :modes '(web-mode js2-jsx-mode rjsx-mode) + :predicate (lambda () + (and + (tide-file-extension-p "jsx") + (tide-flycheck-predicate)))) + +(add-to-list 'flycheck-checkers 'jsx-tide t) + +(flycheck-define-generic-checker 'tsx-tide + "A TSX syntax checker using tsserver." + :start #'tide-flycheck-start + :verify #'tide-flycheck-verify + :modes '(web-mode) + :predicate (lambda () + (and + (tide-file-extension-p "tsx") + (tide-flycheck-predicate)))) + +(add-to-list 'flycheck-checkers 'tsx-tide) + +;;; Project errors + +(defun tide-command:geterrForProject (file) + (tide-send-command + "geterrForProject" + `(:file ,file :delay 0))) + +(defun tide-project-errors-buffer-name () + (format "*%s-errors*" (tide-project-name))) + +(defun tide-display-errors (file-names origin-buffer-file-name) + (let ((origin-buffer (current-buffer))) + (with-current-buffer (get-buffer-create (tide-project-errors-buffer-name)) + (tide-project-errors-mode) + (setq-local tide-origin-buffer-file-name origin-buffer-file-name) + (let ((inhibit-read-only t)) + (erase-buffer)) + (when (not (equal origin-buffer (current-buffer))) + (display-buffer (current-buffer) t)) + (let* ((project-files (-reject (lambda (file-name) + (or (string-match-p "node_modules" file-name) + (string-match-p "tsconfig.json$" file-name))) + file-names)) + (syntax-remaining-files (cl-copy-list project-files)) + (semantic-remaining-files (cl-copy-list project-files)) + (suggestion-remaining-files (if tide-disable-suggestions + '() + (cl-copy-list project-files))) + (syntax-errors 0) + (semantic-errors 0) + (suggestion-errors 0) + (last-file-name nil)) + (tide-set-event-listener + (lambda (response) + (save-excursion + (goto-char (point-max)) + (let ((inhibit-read-only t) + (file-name (tide-plist-get response :body :file)) + (diagnostics (tide-plist-get response :body :diagnostics)) + (event-type (plist-get response :event))) + (when (and + (not (and (string-equal event-type "suggestionDiag") tide-disable-suggestions)) + (member file-name project-files)) + (pcase event-type + ("syntaxDiag" + (setq syntax-remaining-files (remove file-name syntax-remaining-files)) + (cl-incf syntax-errors (length diagnostics))) + ("semanticDiag" + (setq semantic-remaining-files (remove file-name semantic-remaining-files)) + (cl-incf semantic-errors (length diagnostics))) + ("suggestionDiag" + (setq suggestion-remaining-files (remove file-name suggestion-remaining-files)) + (cl-incf suggestion-errors (length diagnostics)))) + + (when diagnostics + (-each diagnostics + (lambda (diagnostic) + (let ((line-number (tide-plist-get diagnostic :start :line))) + (unless (equal last-file-name file-name) + (setq last-file-name file-name) + (insert (propertize (file-relative-name file-name (tide-project-root)) 'face 'tide-file) + "\n")) + + (insert (propertize (format "%5d" line-number) + 'face 'tide-line-number + 'tide-error (plist-put diagnostic :file file-name)) + ": " (plist-get diagnostic :text) "\n"))))) + (when (and (null syntax-remaining-files) (null semantic-remaining-files) (null suggestion-remaining-files)) + (insert (format "\n%d syntax error(s), %d semantic error(s), %d suggestion error(s)\n" + syntax-errors semantic-errors suggestion-errors)) + (goto-char (point-min)) + (tide-clear-event-listener)))))))))) + (tide-command:geterrForProject origin-buffer-file-name)) + +(defun tide-next-error-function (n &optional reset) + "Override for `next-error-function' for use in tide-project-errors-mode buffers." + (interactive "p") + + (-when-let (buffer (get-buffer (tide-project-errors-buffer-name))) + (with-current-buffer buffer + (when reset + (goto-char (point-min))) + (if (> n 0) + (tide-find-next-error (point) n) + (tide-find-previous-error (point) (- n))) + (tide-goto-error)))) + +(defun tide-find-next-error (pos arg) + "Move to next error." + (interactive "d\np") + (setq arg (* 2 arg)) + (unless (get-text-property pos 'tide-error) + (setq arg (1- arg))) + (dotimes (_i arg) + (setq pos (next-single-property-change pos 'tide-error)) + (unless pos + (error "Moved past last error"))) + (goto-char pos)) + +(defun tide-find-previous-error (pos arg) + "Move back to previous error." + (interactive "d\np") + (dotimes (_i (* 2 arg)) + (setq pos (previous-single-property-change pos 'tide-error)) + (unless pos + (error "Moved back before first error"))) + (goto-char pos)) + +(defun tide-goto-error () + "Jump to error location in the file." + (interactive) + (-when-let (error (get-text-property (point) 'tide-error)) + (tide-jump-to-filespan error nil t))) + +(defvar tide-project-errors-mode-map + (let ((map (make-sparse-keymap))) + (define-key map (kbd "n") #'tide-find-next-error) + (define-key map (kbd "p") #'tide-find-previous-error) + (define-key map (kbd "g") #'tide-project-errors) + (define-key map (kbd "RET") #'tide-goto-error) + map)) + +(define-derived-mode tide-project-errors-mode special-mode "tide-project-errors" + "Major mode for tide project-errors list. + +\\{tide-project-errors-mode-map}" + (setq next-error-function #'tide-next-error-function)) + +;;;###autoload +(defun tide-project-errors () + (interactive) + (let ((file (if (string= major-mode "tide-project-errors-mode") + tide-origin-buffer-file-name + (tide-buffer-file-name)))) + (tide-command:projectInfo + (lambda (response) + (tide-on-response-success response + (tide-display-errors (tide-plist-get response :body :fileNames) file))) + t + file))) + +;;; Identifier highlighting +(defun tide-command:documentHighlights (cb) + (tide-send-command + "documentHighlights" + `(:file ,(tide-buffer-file-name) :line ,(tide-line-number-at-pos) :offset ,(tide-current-offset) + :filesToSearch [,(tide-buffer-file-name)]) + cb)) + +(defface tide-hl-identifier-face + '((t (:inherit highlight))) + "Face used for highlighting identifiers in `tide-hl-identifier'." + :group 'tide) + +(defcustom tide-hl-identifier-idle-time 0.50 + "How long to wait after user input before highlighting the current identifier." + :type 'float + :group 'tide) + +(tide-def-permanent-buffer-local tide--hl-last-token 0) + +(defun tide--hl-new-token () + "Invalidate all existing tokens to get document highlights and +create a new token" + (cl-incf tide--hl-last-token)) + +(defvar tide--current-hl-identifier-idle-time + 0 + "The current delay for hl-identifier-mode.") + +(defvar tide--hl-identifier-timer + nil + "The global timer used for highlighting identifiers.") + +;;;###autoload +(defun tide-unhighlight-identifiers () + "Remove highlights from previously highlighted identifier." + (tide--hl-new-token) + (remove-overlays nil nil 'tide-overlay 'sameid)) + +;;;###autoload +(defun tide-hl-identifier () + "Highlight all instances of the identifier under point. Removes +highlights from previously highlighted identifier." + (interactive) + (tide-unhighlight-identifiers) + (tide--hl-identifier)) + +(defun tide--hl-identifier () + "Highlight all instances of the identifier under point." + (let ((token (tide--hl-new-token))) + (tide-command:documentHighlights + (lambda (response) + (when (and + (equal token tide--hl-last-token) + (tide-response-success-p response)) + (tide--hl-highlight response)))))) + +(defun tide--hl-highlight (response) + "Highlight all instances of the identifier under point." + (-when-let* ((item (-first (lambda (item) + (equal (tide-buffer-file-name) (plist-get item :file))) + (plist-get response :body))) + (references (plist-get item :highlightSpans))) + ;; `overlay-recenter' provide a modest speed improvement when creating lots + ;; of overlays from a list. See the documentation on this function for + ;; details. + (overlay-recenter (point-max)) + ;; The point computations in this loop *could* be replaced with + ;; `tide-location-to-point' but `tide-location-to-point' is extremely slow + ;; when it comes to processing large lists of locations because it returns + ;; to `point-min' with each call. + (save-excursion + (save-restriction + (widen) + (goto-char (point-min)) + (let ((current-line 1)) + (dolist (reference references) + (when (member (plist-get reference :kind) '("reference" "writtenReference")) + (let* ((start (plist-get reference :start)) + (end (plist-get reference :end)) + (start-line (plist-get start :line)) + (end-line (plist-get end :line)) + (ostart (progn (forward-line (- start-line current-line)) + (forward-char (1- (plist-get start :offset))) + (point))) + (oend (if (= start-line end-line) + (progn + (forward-char (- (plist-get end :offset) + (plist-get start :offset))) + (point)) + (forward-line (- end-line start-line)) + (forward-char (1- (plist-get end :offset))) + (point))) + (overlay (make-overlay ostart oend))) + (setq current-line end-line) + (overlay-put overlay 'tide-overlay 'sameid) + (overlay-put overlay 'face 'tide-hl-identifier-face))))))))) + +;;;###autoload +(define-minor-mode tide-hl-identifier-mode + "Highlight instances of the identifier at point after a short +timeout." + :group 'tide + (if tide-hl-identifier-mode + (progn + (tide--hl-set-timer) + ;; Unhighlight if point moves off identifier + (add-hook 'post-command-hook #'tide--hl-identifiers-post-command-hook nil t) + ;; Unhighlight any time the buffer changes + (add-hook 'before-change-functions #'tide--hl-identifiers-before-change-function nil t)) + (remove-hook 'post-command-hook #'tide--hl-identifiers-post-command-hook t) + (remove-hook 'before-change-functions #'tide--hl-identifiers-before-change-function t) + (tide-unhighlight-identifiers))) + +(defun tide--hl-identifiers-function () + "Function run after an idle timeout, highlighting the +identifier at point, if necessary." + (when tide-hl-identifier-mode + (unless (tide--on-overlay-p 'sameid) + (tide-hl-identifier)) + (unless (eq tide--current-hl-identifier-idle-time tide-hl-identifier-idle-time) + (tide--hl-set-timer)))) + +(defun tide--hl-set-timer () + (when tide--hl-identifier-timer + (cancel-timer tide--hl-identifier-timer)) + (setq tide--current-hl-identifier-idle-time tide-hl-identifier-idle-time) + (setq tide--hl-identifier-timer (run-with-idle-timer + tide-hl-identifier-idle-time + t + #'tide--hl-identifiers-function))) + +(defun tide--on-overlay-p (id) + "Return whether point is on a tide overlay of type ID." + (cl-find-if (lambda (el) (eq (overlay-get el 'tide-overlay) id)) (overlays-at (point)))) + +(defun tide--hl-identifiers-post-command-hook () + (when (and tide-hl-identifier-mode + (not (tide--on-overlay-p 'sameid))) + (tide-unhighlight-identifiers))) + +(defun tide--hl-identifiers-before-change-function (_beg _end) + (tide-unhighlight-identifiers)) + + +;;; Compile On Save + +(defun tide-command:compileOnSaveEmitFile () + (tide-send-command "compileOnSaveEmitFile" `(:file ,(tide-buffer-file-name)))) + +(defun tide-compile-file () + "Compiles the current file" + (interactive) + (tide-command:compileOnSaveEmitFile)) + +(defun tide-auto-compile-file () + "Compiles the current file if compileOnSave is set" + (interactive) + (-when-let (config (tide-project-config)) + ;; Pre-v3.6.2 tsc converts compileOnSave to compilerOnSave + (when (or (eq (plist-get config :compilerOnSave) t) + (eq (plist-get config :compileOnSave) t)) + (tide-command:compileOnSaveEmitFile)))) + +(defun tide-project-config () + (let ((config (gethash (tide-project-name) tide-project-configs :not-loaded))) + (if (eq config :not-loaded) + (let* ((default-directory (tide-project-root)) + (tscjs (tide-locate-tscompiler-executable))) + (if tscjs + (let ((config (tide-safe-json-read-string + (tide-command-to-string tide-node-executable (list tscjs "--showConfig"))))) + (puthash (tide-project-name) config tide-project-configs)) + (puthash (tide-project-name) '() tide-project-configs))) + config))) + +;;; Utility commands + +(defun tide-kill-server () + "Kill the server in the current buffer." + (interactive) + (-when-let (server (tide-current-server)) + (delete-process server))) + +(defun tide-restart-server () + "Restarts tsserver." + (interactive) + (tide-kill-server) + (tide-start-server)) + +(defvar-local tide--server-list-mode-last-column nil) + +(defun tide--list-servers-verify-setup (button) + "Invoke `tide-verify-setup' on a tsserver displayed in the list of server." + (tide-first-buffer (button-get button 'project-name) #'tide-verify-setup)) + +;; This is modeled after list-process--refresh but we do not call delete-process +;; on exited or signaled processe. That seems inappropriate for a function +;; designed to *report* information. +(defun tide--list-servers-refresh () + "Recompute the list of processes for the buffer displayed by +`tide-list-servers'." + (setq tabulated-list-entries nil) + (let ((tsservers (hash-table-values tide-servers))) + (dolist (p tsservers) + (let* ((project-name (process-get p 'project-name)) + (pid (process-id p)) + (cpu + (if (tide--emacs-at-least "25") + (alist-get 'pcpu (process-attributes pid)) + (cdr (assq 'pcpu (process-attributes pid)))))) + (push (list p + (vector + `(,project-name + face link + help-echo + ,(if (tide--emacs-at-least "25") + (format-message "Verify setup of `%s'" project-name) + (concat "Verify setup of `" project-name "'")) + follow-link t + project-name ,project-name + action tide--list-servers-verify-setup) + ;; Sometimes the CPU usage value is NaN (which Emacs represents + ;; as 0.0e+NaN), for whatever reason. We cannot pass this value + ;; to round so we put "--" for the column value. + ;; Other times, it is nil, so do the same then. + (if (or (not cpu) (isnan cpu)) + "--" + (number-to-string (round cpu))) + (cl-case tide--server-list-mode-last-column + ((project-root) + (or (process-get p 'project-root) "")) + ((command) + (mapconcat 'identity (process-command p) " ")) + (t (error "unknown column %s" + tide--server-list-mode-last-column))))) + tabulated-list-entries))))) + +(defun tide--server-list-kill-server () + "Kill a tsserver instance." + (interactive) + (let ((process (tabulated-list-get-id))) + (delete-process process) + (revert-buffer))) + +(defvar tide--server-list-last-column-choice-list + '(project-root command) + "The possible choices for the last column, as a circular list.") + +(defun tide--server-list-cycle-last-column () + "Cycle through the possible values for the last column." + (interactive) + (setq tide--server-list-mode-last-column + (or (cadr (or (memq tide--server-list-mode-last-column + tide--server-list-last-column-choice-list) + (error "%s is not a possible choice of last column." + tide--server-list-mode-last-column))) + (car tide--server-list-last-column-choice-list))) + (tide--setup-list-mode) + (revert-buffer)) + +(defvar tide-server-list-mode-map + (let ((map (make-sparse-keymap))) + (define-key map [?d] 'tide--server-list-kill-server) + (define-key map [?/] 'tide--server-list-cycle-last-column) + map)) + +(defun tide--setup-list-mode () + (setq tabulated-list-format + (vector + '("Project Name" 20 t) + `("CPU" 5 ,(lambda (a b) + (let* ((cpu-a (elt (cadr a) 1)) + (cpu-b (elt (cadr b) 1))) + ;; The CPU usage value in the column can be "--" if Emacs + ;; produced a NaN value. We consider "--" to be less than numbers. + (cond + ((string= cpu-a "--") + (not (string= cpu-b "--"))) + ((string= cpu-b "--") nil) + (t + (< (string-to-number cpu-a) + (string-to-number cpu-b))))))) + (list + (cl-case tide--server-list-mode-last-column + ((project-root) "Project Root") + ((command) "Project Command") + (t (error "unknown column %s" tide--server-list-mode-last-column))) + 0 t))) + (setq tabulated-list-sort-key (cons "Project Name" nil)) + (tabulated-list-init-header)) + +(define-derived-mode tide-server-list-mode tabulated-list-mode "tide-server-list-mode" + "Major mode for listing tsserver processes." + (setq-local tide--server-list-mode-last-column 'project-root) + (add-hook 'tabulated-list-revert-hook 'tide--list-servers-refresh nil t) + (tide--setup-list-mode)) + +;; This is modeled after list-processes. +(defun tide-list-servers (&optional buffer) + "Lists the tsserver processes known to tide." + (interactive) + (unless (bufferp buffer) + (setq buffer (get-buffer-create "*Tide Server List*"))) + (with-current-buffer buffer + (tide-server-list-mode) + (tide--list-servers-refresh) + (tabulated-list-print)) + (display-buffer buffer) + nil) + +(defun tide-command:status () + (tide-send-command-sync "status" '())) + +(defun tide-show-project-info (version config-file-name) + (with-current-buffer (get-buffer-create "*tide-project-info*") + (let ((inhibit-read-only t)) + (erase-buffer) + (insert "tsserver version: " + (propertize version 'face '(success bold)) + "\n\n" + "config file path: " + (propertize config-file-name 'face 'success))) + (special-mode) + (display-buffer (current-buffer) t))) + +(defun tide-verify-setup () + "Show the version of tsserver." + (interactive) + (let ((response (tide-command:status))) + (tide-on-response-success response (:min-version "2.7") + (let ((version (tide-plist-get response :body :version))) + (tide-command:projectInfo + (lambda (response) + (tide-on-response-success response + (let ((config-file-name (tide-plist-get response :body :configFileName))) + (tide-show-project-info version config-file-name))))))))) + + +;;; xref integration + +(defun xref-tide-xref-backend () + "Xref-tide backend for xref." + 'xref-tide) + +(cl-defmethod xref-backend-identifier-at-point ((_backend (eql xref-tide))) + (let ((symbol (tide-get-symbol-at-point))) + (when (and symbol + (not (string-equal symbol ""))) + (put-text-property 0 1 'location `(:file ,(tide-buffer-file-name) :line ,(tide-line-number-at-pos) :offset ,(tide-current-offset)) symbol)) + symbol)) + +(defvar tide-xref--last-completion-table '()) + +(cl-defmethod xref-backend-identifier-completion-table ((_backend (eql xref-tide))) + (completion-table-dynamic + (lambda (prefix) + (let ((response (tide-command:navto prefix t))) + (tide-on-response-success response + (-when-let (navto-items (plist-get response :body)) + (setq tide-xref--last-completion-table navto-items) + (-map (lambda (navto-item) (plist-get navto-item :name)) navto-items))))) + t)) + +(cl-defmethod xref-backend-identifier-completion-ignore-case ((_backend (eql xref-tide))) + tide-completion-ignore-case) + +(cl-defmethod xref-backend-references ((_backend (eql xref-tide)) symbol) + (tide-xref--find-references symbol)) + +(cl-defmethod xref-backend-definitions ((_backend (eql xref-tide)) symbol) + (tide-xref--find-definitions symbol)) + +(cl-defmethod xref-backend-apropos ((_backend (eql xref-tide)) pattern) + (tide-xref--find-apropos pattern)) + +(defun tide-xref--make-reference (reference) + "Make xref object from RERERENCE." + (let ((full-file-name (plist-get reference :file)) + (line-number (tide-plist-get reference :start :line)) + (line-text (plist-get reference :lineText)) + (start (1- (tide-plist-get reference :start :offset))) + (end (1- (tide-plist-get reference :end :offset)))) + (put-text-property start end 'face 'tide-match line-text) + (xref-make line-text + (xref-make-file-location full-file-name + line-number + start)))) + +(defun tide-xref--make-definition (symbol definition) + "Make xref object from DEFINITION." + (let ((full-file-name (plist-get definition :file)) + (line-number (tide-plist-get definition :start :line)) + (start (1- (tide-plist-get definition :start :offset)))) + (xref-make symbol + (xref-make-file-location full-file-name + line-number + start)))) + +(defun tide-xref--make-navto (pattern navto) + "Make xref object from NAVTO." + (let ((full-file-name (plist-get navto :file)) + (line-text (tide-file-span-first-line-text navto pattern)) + (line-number (tide-plist-get navto :start :line)) + (start (1- (tide-plist-get navto :start :offset)))) + (xref-make line-text + (xref-make-file-location full-file-name + line-number + start)))) + +(defun tide-xref--symbol-location (symbol) + (-if-let (location (get-text-property 0 'location symbol)) + location + (-when-let (navto-item (-find (lambda (navto-item) (string-equal symbol (plist-get navto-item :name))) + tide-xref--last-completion-table)) + (save-restriction + (save-excursion + (widen) + (tide-move-to-location (plist-get navto-item :start)) + (search-forward symbol (tide-location-to-point (plist-get navto-item :end))) + `(:file ,(plist-get navto-item :file) + :line ,(tide-line-number-at-pos) + :offset ,(tide-current-offset))))))) + + +(defun tide-xref--find-definitions (symbol) + "Return xref definition objects." + (let ((response (tide-command:definition nil (tide-xref--symbol-location symbol)))) + (tide-on-response-success response + (let ((definitions (tide-plist-get response :body))) + (-map (apply-partially #'tide-xref--make-definition symbol) definitions))))) + +(defun tide-xref--find-references (symbol) + "Return xref reference objects." + (let ((response (tide-command:references (tide-xref--symbol-location symbol)))) + (tide-on-response-success response + (let ((references (tide-plist-get response :body :refs))) + (-map #'tide-xref--make-reference references))))) + +(defun tide-xref--find-apropos (pattern) + "Return xref navto objects." + (let ((response (tide-command:navto pattern))) + (tide-on-response-success response + (-when-let (navto-items (plist-get response :body)) + (-map (apply-partially #'tide-xref--make-navto pattern) navto-items))))) + +(provide 'tide) + +;;; tide.el ends here diff --git a/elpa/tide-20220514.614/tide.elc b/elpa/tide-20220514.614/tide.elc new file mode 100644 index 0000000..d8b1efe Binary files /dev/null and b/elpa/tide-20220514.614/tide.elc differ diff --git a/elpa/tide-20220514.614/tsserver/lib.core.d.ts b/elpa/tide-20220514.614/tsserver/lib.core.d.ts new file mode 100644 index 0000000..b588c9f --- /dev/null +++ b/elpa/tide-20220514.614/tsserver/lib.core.d.ts @@ -0,0 +1,3840 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +/// + +///////////////////////////// +/// ECMAScript APIs +///////////////////////////// + +declare var NaN: number; +declare var Infinity: number; + +/** + * Evaluates JavaScript code and executes it. + * @param x A String value that contains valid JavaScript code. + */ +declare function eval(x: string): any; + +/** + * Converts A string to an integer. + * @param s A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. + */ +declare function parseInt(s: string, radix?: number): number; + +/** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ +declare function parseFloat(string: string): number; + +/** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). + * @param number A numeric value. + */ +declare function isNaN(number: number): boolean; + +/** + * Determines whether a supplied number is finite. + * @param number Any numeric value. + */ +declare function isFinite(number: number): boolean; + +/** + * Gets the unencoded version of an encoded Uniform Resource Identifier (URI). + * @param encodedURI A value representing an encoded URI. + */ +declare function decodeURI(encodedURI: string): string; + +/** + * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI). + * @param encodedURIComponent A value representing an encoded URI component. + */ +declare function decodeURIComponent(encodedURIComponent: string): string; + +/** + * Encodes a text string as a valid Uniform Resource Identifier (URI) + * @param uri A value representing an encoded URI. + */ +declare function encodeURI(uri: string): string; + +/** + * Encodes a text string as a valid component of a Uniform Resource Identifier (URI). + * @param uriComponent A value representing an encoded URI component. + */ +declare function encodeURIComponent(uriComponent: string): string; + +interface PropertyDescriptor { + configurable?: boolean; + enumerable?: boolean; + value?: any; + writable?: boolean; + get? (): any; + set? (v: any): void; +} + +interface PropertyDescriptorMap { + [s: string]: PropertyDescriptor; +} + +interface Object { + /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ + constructor: Function; + + /** Returns a string representation of an object. */ + toString(): string; + + /** Returns a date converted to a string using the current locale. */ + toLocaleString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Object; + + /** + * Determines whether an object has a property with the specified name. + * @param v A property name. + */ + hasOwnProperty(v: string): boolean; + + /** + * Determines whether an object exists in another object's prototype chain. + * @param v Another object whose prototype chain is to be checked. + */ + isPrototypeOf(v: Object): boolean; + + /** + * Determines whether a specified property is enumerable. + * @param v A property name. + */ + propertyIsEnumerable(v: string): boolean; +} + +interface ObjectConstructor { + new (value?: any): Object; + (): any; + (value: any): any; + + /** A reference to the prototype for a class of objects. */ + prototype: Object; + + /** + * Returns the prototype of an object. + * @param o The object that references the prototype. + */ + getPrototypeOf(o: any): any; + + /** + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; + + /** + * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly + * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. + * @param o Object that contains the own properties. + */ + getOwnPropertyNames(o: any): string[]; + + /** + * Creates an object that has the specified prototype, and that optionally contains specified properties. + * @param o Object to use as a prototype. May be null + * @param properties JavaScript object that contains one or more property descriptors. + */ + create(o: any, properties?: PropertyDescriptorMap): any; + + /** + * Adds a property to an object, or modifies attributes of an existing property. + * @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. + * @param p The property name. + * @param attributes Descriptor for the property. It can be for a data property or an accessor property. + */ + defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; + + /** + * Adds one or more properties to an object, and/or modifies attributes of existing properties. + * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. + * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. + */ + defineProperties(o: any, properties: PropertyDescriptorMap): any; + + /** + * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + seal(o: T): T; + + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + freeze(o: T): T; + + /** + * Prevents the addition of new properties to an object. + * @param o Object to make non-extensible. + */ + preventExtensions(o: T): T; + + /** + * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. + * @param o Object to test. + */ + isSealed(o: any): boolean; + + /** + * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. + * @param o Object to test. + */ + isFrozen(o: any): boolean; + + /** + * Returns a value that indicates whether new properties can be added to an object. + * @param o Object to test. + */ + isExtensible(o: any): boolean; + + /** + * Returns the names of the enumerable properties and methods of an object. + * @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. + */ + keys(o: any): string[]; +} + +/** + * Provides functionality common to all JavaScript objects. + */ +declare var Object: ObjectConstructor; + +/** + * Creates a new function. + */ +interface Function { + /** + * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function. + * @param thisArg The object to be used as the this object. + * @param argArray A set of arguments to be passed to the function. + */ + apply(thisArg: any, argArray?: any): any; + + /** + * Calls a method of an object, substituting another object for the current object. + * @param thisArg The object to be used as the current object. + * @param argArray A list of arguments to be passed to the method. + */ + call(thisArg: any, ...argArray: any[]): any; + + /** + * For a given function, creates a bound function that has the same body as the original function. + * The this object of the bound function is associated with the specified object, and has the specified initial parameters. + * @param thisArg An object to which the this keyword can refer inside the new function. + * @param argArray A list of arguments to be passed to the new function. + */ + bind(thisArg: any, ...argArray: any[]): any; + + prototype: any; + length: number; + + // Non-standard extensions + arguments: any; + caller: Function; +} + +interface FunctionConstructor { + /** + * Creates a new function. + * @param args A list of arguments the function accepts. + */ + new (...args: string[]): Function; + (...args: string[]): Function; + prototype: Function; +} + +declare var Function: FunctionConstructor; + +interface IArguments { + [index: number]: any; + length: number; + callee: Function; +} + +interface String { + /** Returns a string representation of a string. */ + toString(): string; + + /** + * Returns the character at the specified index. + * @param pos The zero-based index of the desired character. + */ + charAt(pos: number): string; + + /** + * Returns the Unicode value of the character at the specified location. + * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. + */ + charCodeAt(index: number): number; + + /** + * Returns a string that contains the concatenation of two or more strings. + * @param strings The strings to append to the end of the string. + */ + concat(...strings: string[]): string; + + /** + * Returns the position of the first occurrence of a substring. + * @param searchString The substring to search for in the string + * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. + */ + indexOf(searchString: string, position?: number): number; + + /** + * Returns the last occurrence of a substring in the string. + * @param searchString The substring to search for. + * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. + */ + lastIndexOf(searchString: string, position?: number): number; + + /** + * Determines whether two strings are equivalent in the current locale. + * @param that String to compare to target string + */ + localeCompare(that: string): number; + + /** + * Matches a string with a regular expression, and returns an array containing the results of that search. + * @param regexp A variable name or string literal containing the regular expression pattern and flags. + */ + match(regexp: string): RegExpMatchArray; + + /** + * Matches a string with a regular expression, and returns an array containing the results of that search. + * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. + */ + match(regexp: RegExp): RegExpMatchArray; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A string that represents the regular expression. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replace(searchValue: string, replaceValue: string): string; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A string that represents the regular expression. + * @param replacer A function that returns the replacement text. + */ + replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replace(searchValue: RegExp, replaceValue: string): string; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags + * @param replacer A function that returns the replacement text. + */ + replace(searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the first substring match in a regular expression search. + * @param regexp The regular expression pattern and applicable flags. + */ + search(regexp: string): number; + + /** + * Finds the first substring match in a regular expression search. + * @param regexp The regular expression pattern and applicable flags. + */ + search(regexp: RegExp): number; + + /** + * Returns a section of a string. + * @param start The index to the beginning of the specified portion of stringObj. + * @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. + * If this value is not specified, the substring continues to the end of stringObj. + */ + slice(start?: number, end?: number): string; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @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. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(separator: string, limit?: number): string[]; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(separator: RegExp, limit?: number): string[]; + + /** + * Returns the substring at the specified location within a String object. + * @param start The zero-based index number indicating the beginning of the substring. + * @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. + * If end is omitted, the characters from start through the end of the original string are returned. + */ + substring(start: number, end?: number): string; + + /** Converts all the alphabetic characters in a string to lowercase. */ + toLowerCase(): string; + + /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ + toLocaleLowerCase(): string; + + /** Converts all the alphabetic characters in a string to uppercase. */ + toUpperCase(): string; + + /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ + toLocaleUpperCase(): string; + + /** Removes the leading and trailing white space and line terminator characters from a string. */ + trim(): string; + + /** Returns the length of a String object. */ + length: number; + + // IE extensions + /** + * Gets a substring beginning at the specified location and having the specified length. + * @param from The starting position of the desired substring. The index of the first character in the string is zero. + * @param length The number of characters to include in the returned substring. + */ + substr(from: number, length?: number): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): string; + + [index: number]: string; +} + +interface StringConstructor { + new (value?: any): String; + (value?: any): string; + prototype: String; + fromCharCode(...codes: number[]): string; +} + +/** + * Allows manipulation and formatting of text strings and determination and location of substrings within strings. + */ +declare var String: StringConstructor; + +interface Boolean { + /** Returns the primitive value of the specified object. */ + valueOf(): boolean; +} + +interface BooleanConstructor { + new (value?: any): Boolean; + (value?: any): boolean; + prototype: Boolean; +} + +declare var Boolean: BooleanConstructor; + +interface Number { + /** + * Returns a string representation of an object. + * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. + */ + toString(radix?: number): string; + + /** + * Returns a string representing a number in fixed-point notation. + * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. + */ + toFixed(fractionDigits?: number): string; + + /** + * Returns a string containing a number represented in exponential notation. + * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. + */ + toExponential(fractionDigits?: number): string; + + /** + * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits. + * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. + */ + toPrecision(precision?: number): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): number; +} + +interface NumberConstructor { + new (value?: any): Number; + (value?: any): number; + prototype: Number; + + /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ + MAX_VALUE: number; + + /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ + MIN_VALUE: number; + + /** + * A value that is not a number. + * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. + */ + NaN: number; + + /** + * A value that is less than the largest negative number that can be represented in JavaScript. + * JavaScript displays NEGATIVE_INFINITY values as -infinity. + */ + NEGATIVE_INFINITY: number; + + /** + * A value greater than the largest number that can be represented in JavaScript. + * JavaScript displays POSITIVE_INFINITY values as infinity. + */ + POSITIVE_INFINITY: number; +} + +/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ +declare var Number: NumberConstructor; + +interface TemplateStringsArray extends Array { + raw: string[]; +} + +interface Math { + /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ + E: number; + /** The natural logarithm of 10. */ + LN10: number; + /** The natural logarithm of 2. */ + LN2: number; + /** The base-2 logarithm of e. */ + LOG2E: number; + /** The base-10 logarithm of e. */ + LOG10E: number; + /** Pi. This is the ratio of the circumference of a circle to its diameter. */ + PI: number; + /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ + SQRT1_2: number; + /** The square root of 2. */ + SQRT2: number; + /** + * Returns the absolute value of a number (the value without regard to whether it is positive or negative). + * For example, the absolute value of -5 is the same as the absolute value of 5. + * @param x A numeric expression for which the absolute value is needed. + */ + abs(x: number): number; + /** + * Returns the arc cosine (or inverse cosine) of a number. + * @param x A numeric expression. + */ + acos(x: number): number; + /** + * Returns the arcsine of a number. + * @param x A numeric expression. + */ + asin(x: number): number; + /** + * Returns the arctangent of a number. + * @param x A numeric expression for which the arctangent is needed. + */ + atan(x: number): number; + /** + * Returns the angle (in radians) from the X axis to a point. + * @param y A numeric expression representing the cartesian y-coordinate. + * @param x A numeric expression representing the cartesian x-coordinate. + */ + atan2(y: number, x: number): number; + /** + * Returns the smallest number greater than or equal to its numeric argument. + * @param x A numeric expression. + */ + ceil(x: number): number; + /** + * Returns the cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cos(x: number): number; + /** + * Returns e (the base of natural logarithms) raised to a power. + * @param x A numeric expression representing the power of e. + */ + exp(x: number): number; + /** + * Returns the greatest number less than or equal to its numeric argument. + * @param x A numeric expression. + */ + floor(x: number): number; + /** + * Returns the natural logarithm (base e) of a number. + * @param x A numeric expression. + */ + log(x: number): number; + /** + * Returns the larger of a set of supplied numeric expressions. + * @param values Numeric expressions to be evaluated. + */ + max(...values: number[]): number; + /** + * Returns the smaller of a set of supplied numeric expressions. + * @param values Numeric expressions to be evaluated. + */ + min(...values: number[]): number; + /** + * Returns the value of a base expression taken to a specified power. + * @param x The base value of the expression. + * @param y The exponent value of the expression. + */ + pow(x: number, y: number): number; + /** Returns a pseudorandom number between 0 and 1. */ + random(): number; + /** + * Returns a supplied numeric expression rounded to the nearest number. + * @param x The value to be rounded to the nearest number. + */ + round(x: number): number; + /** + * Returns the sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sin(x: number): number; + /** + * Returns the square root of a number. + * @param x A numeric expression. + */ + sqrt(x: number): number; + /** + * Returns the tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tan(x: number): number; +} +/** An intrinsic object that provides basic mathematics functionality and constants. */ +declare var Math: Math; + +/** Enables basic storage and retrieval of dates and times. */ +interface Date { + /** Returns a string representation of a date. The format of the string depends on the locale. */ + toString(): string; + /** Returns a date as a string value. */ + toDateString(): string; + /** Returns a time as a string value. */ + toTimeString(): string; + /** Returns a value as a string value appropriate to the host environment's current locale. */ + toLocaleString(): string; + /** Returns a date as a string value appropriate to the host environment's current locale. */ + toLocaleDateString(): string; + /** Returns a time as a string value appropriate to the host environment's current locale. */ + toLocaleTimeString(): string; + /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */ + valueOf(): number; + /** Gets the time value in milliseconds. */ + getTime(): number; + /** Gets the year, using local time. */ + getFullYear(): number; + /** Gets the year using Universal Coordinated Time (UTC). */ + getUTCFullYear(): number; + /** Gets the month, using local time. */ + getMonth(): number; + /** Gets the month of a Date object using Universal Coordinated Time (UTC). */ + getUTCMonth(): number; + /** Gets the day-of-the-month, using local time. */ + getDate(): number; + /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */ + getUTCDate(): number; + /** Gets the day of the week, using local time. */ + getDay(): number; + /** Gets the day of the week using Universal Coordinated Time (UTC). */ + getUTCDay(): number; + /** Gets the hours in a date, using local time. */ + getHours(): number; + /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */ + getUTCHours(): number; + /** Gets the minutes of a Date object, using local time. */ + getMinutes(): number; + /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */ + getUTCMinutes(): number; + /** Gets the seconds of a Date object, using local time. */ + getSeconds(): number; + /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCSeconds(): number; + /** Gets the milliseconds of a Date, using local time. */ + getMilliseconds(): number; + /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCMilliseconds(): number; + /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ + getTimezoneOffset(): number; + /** + * Sets the date and time value in the Date object. + * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. + */ + setTime(time: number): number; + /** + * Sets the milliseconds value in the Date object using local time. + * @param ms A numeric value equal to the millisecond value. + */ + setMilliseconds(ms: number): number; + /** + * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). + * @param ms A numeric value equal to the millisecond value. + */ + setUTCMilliseconds(ms: number): number; + + /** + * Sets the seconds value in the Date object using local time. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setSeconds(sec: number, ms?: number): number; + /** + * Sets the seconds value in the Date object using Universal Coordinated Time (UTC). + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCSeconds(sec: number, ms?: number): number; + /** + * Sets the minutes value in the Date object using local time. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setMinutes(min: number, sec?: number, ms?: number): number; + /** + * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCMinutes(min: number, sec?: number, ms?: number): number; + /** + * Sets the hour value in the Date object using local time. + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setHours(hours: number, min?: number, sec?: number, ms?: number): number; + /** + * Sets the hours value in the Date object using Universal Coordinated Time (UTC). + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; + /** + * Sets the numeric day-of-the-month value of the Date object using local time. + * @param date A numeric value equal to the day of the month. + */ + setDate(date: number): number; + /** + * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). + * @param date A numeric value equal to the day of the month. + */ + setUTCDate(date: number): number; + /** + * Sets the month value in the Date object using local time. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @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. + */ + setMonth(month: number, date?: number): number; + /** + * Sets the month value in the Date object using Universal Coordinated Time (UTC). + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @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. + */ + setUTCMonth(month: number, date?: number): number; + /** + * Sets the year of the Date object using local time. + * @param year A numeric value for the year. + * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified. + * @param date A numeric value equal for the day of the month. + */ + setFullYear(year: number, month?: number, date?: number): number; + /** + * Sets the year value in the Date object using Universal Coordinated Time (UTC). + * @param year A numeric value equal to the year. + * @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. + * @param date A numeric value equal to the day of the month. + */ + setUTCFullYear(year: number, month?: number, date?: number): number; + /** Returns a date converted to a string using Universal Coordinated Time (UTC). */ + toUTCString(): string; + /** Returns a date as a string value in ISO format. */ + toISOString(): string; + /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */ + toJSON(key?: any): string; +} + +interface DateConstructor { + new (): Date; + new (value: number): Date; + new (value: string): Date; + new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; + (): string; + prototype: Date; + /** + * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. + * @param s A date string + */ + parse(s: string): number; + /** + * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. + * @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. + * @param month The month as an number between 0 and 11 (January to December). + * @param date The date as an number between 1 and 31. + * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour. + * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes. + * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds. + * @param ms An number from 0 to 999 that specifies the milliseconds. + */ + UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; + now(): number; +} + +declare var Date: DateConstructor; + +interface RegExpMatchArray extends Array { + index?: number; + input?: string; +} + +interface RegExpExecArray extends Array { + index: number; + input: string; +} + +interface RegExp { + /** + * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. + * @param string The String object or string literal on which to perform the search. + */ + exec(string: string): RegExpExecArray; + + /** + * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. + * @param string String on which to perform the search. + */ + test(string: string): boolean; + + /** 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. */ + source: string; + + /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ + global: boolean; + + /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ + ignoreCase: boolean; + + /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ + multiline: boolean; + + lastIndex: number; + + // Non-standard extensions + compile(): RegExp; +} + +interface RegExpConstructor { + new (pattern: string, flags?: string): RegExp; + (pattern: string, flags?: string): RegExp; + prototype: RegExp; + + // Non-standard extensions + $1: string; + $2: string; + $3: string; + $4: string; + $5: string; + $6: string; + $7: string; + $8: string; + $9: string; + lastMatch: string; +} + +declare var RegExp: RegExpConstructor; + +interface Error { + name: string; + message: string; +} + +interface ErrorConstructor { + new (message?: string): Error; + (message?: string): Error; + prototype: Error; +} + +declare var Error: ErrorConstructor; + +interface EvalError extends Error { +} + +interface EvalErrorConstructor { + new (message?: string): EvalError; + (message?: string): EvalError; + prototype: EvalError; +} + +declare var EvalError: EvalErrorConstructor; + +interface RangeError extends Error { +} + +interface RangeErrorConstructor { + new (message?: string): RangeError; + (message?: string): RangeError; + prototype: RangeError; +} + +declare var RangeError: RangeErrorConstructor; + +interface ReferenceError extends Error { +} + +interface ReferenceErrorConstructor { + new (message?: string): ReferenceError; + (message?: string): ReferenceError; + prototype: ReferenceError; +} + +declare var ReferenceError: ReferenceErrorConstructor; + +interface SyntaxError extends Error { +} + +interface SyntaxErrorConstructor { + new (message?: string): SyntaxError; + (message?: string): SyntaxError; + prototype: SyntaxError; +} + +declare var SyntaxError: SyntaxErrorConstructor; + +interface TypeError extends Error { +} + +interface TypeErrorConstructor { + new (message?: string): TypeError; + (message?: string): TypeError; + prototype: TypeError; +} + +declare var TypeError: TypeErrorConstructor; + +interface URIError extends Error { +} + +interface URIErrorConstructor { + new (message?: string): URIError; + (message?: string): URIError; + prototype: URIError; +} + +declare var URIError: URIErrorConstructor; + +interface JSON { + /** + * Converts a JavaScript Object Notation (JSON) string into an object. + * @param text A valid JSON string. + * @param reviver A function that transforms the results. This function is called for each member of the object. + * If a member contains nested objects, the nested objects are transformed before the parent object is. + */ + parse(text: string, reviver?: (key: any, value: any) => any): any; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + */ + stringify(value: any): string; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer A function that transforms the results. + */ + stringify(value: any, replacer: (key: string, value: any) => any): string; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer Array that transforms the results. + */ + stringify(value: any, replacer: any[]): string; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer A function that transforms the results. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + */ + stringify(value: any, replacer: (key: string, value: any) => any, space: string | number): string; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer Array that transforms the results. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + */ + stringify(value: any, replacer: any[], space: string | number): string; +} +/** + * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. + */ +declare var JSON: JSON; + + +///////////////////////////// +/// ECMAScript Array API (specially handled by compiler) +///////////////////////////// + +interface Array { + /** + * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. + */ + length: number; + /** + * Returns a string representation of an array. + */ + toString(): string; + toLocaleString(): string; + /** + * Appends new elements to an array, and returns the new length of the array. + * @param items New elements of the Array. + */ + push(...items: T[]): number; + /** + * Removes the last element from an array and returns it. + */ + pop(): T; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: U[]): T[]; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: T[]): T[]; + /** + * Adds all the elements of an array separated by the specified separator string. + * @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. + */ + join(separator?: string): string; + /** + * Reverses the elements in an Array. + */ + reverse(): T[]; + /** + * Removes the first element from an array and returns it. + */ + shift(): T; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): T[]; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: T, b: T) => number): T[]; + + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + */ + splice(start: number): T[]; + + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + * @param deleteCount The number of elements to remove. + * @param items Elements to insert into the array in place of the deleted elements. + */ + splice(start: number, deleteCount: number, ...items: T[]): T[]; + + /** + * Inserts new elements at the start of an array. + * @param items Elements to insert at the start of the Array. + */ + unshift(...items: T[]): number; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + */ + indexOf(searchElement: T, fromIndex?: number): number; + + /** + * Returns the index of the last occurrence of a specified value in an array. + * @param searchElement The value to locate in the array. + * @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. + */ + lastIndexOf(searchElement: T, fromIndex?: number): number; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. + * @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. + */ + every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. + * @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. + */ + some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @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. + */ + forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; + + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @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. + * @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. + */ + map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * @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. + */ + filter(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + + [n: number]: T; +} + +interface ArrayConstructor { + new (arrayLength?: number): any[]; + new (arrayLength: number): T[]; + new (...items: T[]): T[]; + (arrayLength?: number): any[]; + (arrayLength: number): T[]; + (...items: T[]): T[]; + isArray(arg: any): arg is Array; + prototype: Array; +} + +declare var Array: ArrayConstructor; + +interface TypedPropertyDescriptor { + enumerable?: boolean; + configurable?: boolean; + writable?: boolean; + value?: T; + get?: () => T; + set?: (value: T) => void; +} + +declare type ClassDecorator = (target: TFunction) => TFunction | void; +declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void; +declare type MethodDecorator = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void; +declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void; + +declare type PromiseConstructorLike = new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike; + +interface PromiseLike { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; +} + +interface ArrayLike { + length: number; + [n: number]: T; +} + + +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { + /** + * Read-only. The length of the ArrayBuffer (in bytes). + */ + byteLength: number; + + /** + * Returns a section of an ArrayBuffer. + */ + slice(begin:number, end?:number): ArrayBuffer; +} + +interface ArrayBufferConstructor { + prototype: ArrayBuffer; + new (byteLength: number): ArrayBuffer; + isView(arg: any): boolean; +} +declare var ArrayBuffer: ArrayBufferConstructor; + +interface ArrayBufferView { + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; +} + +interface DataView { + buffer: ArrayBuffer; + byteLength: number; + byteOffset: number; + /** + * Gets the Float32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Float64 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat64(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Int8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt8(byteOffset: number): number; + + /** + * Gets the Int16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt16(byteOffset: number, littleEndian?: boolean): number; + /** + * Gets the Int32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Uint8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint8(byteOffset: number): number; + + /** + * Gets the Uint16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint16(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Uint32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Stores an Float32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Float64 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Int8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setInt8(byteOffset: number, value: number): void; + + /** + * Stores an Int16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Int32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Uint8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setUint8(byteOffset: number, value: number): void; + + /** + * Stores an Uint16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Uint32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; +} + +interface DataViewConstructor { + new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; +} +declare var DataView: DataViewConstructor; + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Int8Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @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. + */ + every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Int8Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @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. + */ + filter(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): Int8Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @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. + */ + forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @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. + * @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. + */ + map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int8Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int8Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @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. + */ + some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Int8Array; + + /** + * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int8Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} +interface Int8ArrayConstructor { + prototype: Int8Array; + new (length: number): Int8Array; + new (array: ArrayLike): Int8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; + +} +declare var Int8Array: Int8ArrayConstructor; + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Uint8Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @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. + */ + every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Uint8Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @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. + */ + filter(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): Uint8Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @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. + */ + forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @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. + * @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. + */ + map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint8Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint8Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @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. + */ + some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Uint8Array; + + /** + * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint8Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint8ArrayConstructor { + prototype: Uint8Array; + new (length: number): Uint8Array; + new (array: ArrayLike): Uint8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; + +} +declare var Uint8Array: Uint8ArrayConstructor; + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Uint8ClampedArray; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @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. + */ + every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Uint8ClampedArray; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @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. + */ + filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): Uint8ClampedArray; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @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. + */ + forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @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. + * @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. + */ + map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint8ClampedArray; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Uint8ClampedArray, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint8ClampedArray; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @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. + */ + some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Uint8ClampedArray; + + /** + * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint8ClampedArray; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint8ClampedArrayConstructor { + prototype: Uint8ClampedArray; + new (length: number): Uint8ClampedArray; + new (array: ArrayLike): Uint8ClampedArray; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8ClampedArray; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; +} +declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Int16Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @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. + */ + every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Int16Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @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. + */ + filter(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): Int16Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @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. + */ + forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @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. + * @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. + */ + map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int16Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int16Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @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. + */ + some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Int16Array; + + /** + * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int16Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Int16ArrayConstructor { + prototype: Int16Array; + new (length: number): Int16Array; + new (array: ArrayLike): Int16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; + +} +declare var Int16Array: Int16ArrayConstructor; + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Uint16Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @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. + */ + every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Uint16Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @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. + */ + filter(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): Uint16Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @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. + */ + forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @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. + * @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. + */ + map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint16Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint16Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @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. + */ + some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Uint16Array; + + /** + * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint16Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint16ArrayConstructor { + prototype: Uint16Array; + new (length: number): Uint16Array; + new (array: ArrayLike): Uint16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; + +} +declare var Uint16Array: Uint16ArrayConstructor; +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Int32Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @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. + */ + every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Int32Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @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. + */ + filter(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): Int32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @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. + */ + forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @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. + * @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. + */ + map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @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. + */ + some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Int32Array; + + /** + * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Int32ArrayConstructor { + prototype: Int32Array; + new (length: number): Int32Array; + new (array: ArrayLike): Int32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; +} +declare var Int32Array: Int32ArrayConstructor; + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Uint32Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @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. + */ + every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Uint32Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @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. + */ + filter(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): Uint32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @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. + */ + forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @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. + * @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. + */ + map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @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. + */ + some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Uint32Array; + + /** + * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint32ArrayConstructor { + prototype: Uint32Array; + new (length: number): Uint32Array; + new (array: ArrayLike): Uint32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; +} +declare var Uint32Array: Uint32ArrayConstructor; + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Float32Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @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. + */ + every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Float32Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @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. + */ + filter(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): Float32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @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. + */ + forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @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. + * @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. + */ + map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Float32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Float32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @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. + */ + some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Float32Array; + + /** + * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Float32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Float32ArrayConstructor { + prototype: Float32Array; + new (length: number): Float32Array; + new (array: ArrayLike): Float32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; + +} +declare var Float32Array: Float32ArrayConstructor; + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Float64Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @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. + */ + every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Float64Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @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. + */ + filter(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): Float64Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @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. + */ + forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @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. + * @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. + */ + map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Float64Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Float64Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @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. + */ + some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Float64Array; + + /** + * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Float64Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Float64ArrayConstructor { + prototype: Float64Array; + new (length: number): Float64Array; + new (array: ArrayLike): Float64Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float64Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; +} +declare var Float64Array: Float64ArrayConstructor; diff --git a/elpa/tide-20220514.614/tsserver/lib.core.es6.d.ts b/elpa/tide-20220514.614/tsserver/lib.core.es6.d.ts new file mode 100644 index 0000000..fd11549 --- /dev/null +++ b/elpa/tide-20220514.614/tsserver/lib.core.es6.d.ts @@ -0,0 +1,5128 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +/// + +///////////////////////////// +/// ECMAScript APIs +///////////////////////////// + +declare var NaN: number; +declare var Infinity: number; + +/** + * Evaluates JavaScript code and executes it. + * @param x A String value that contains valid JavaScript code. + */ +declare function eval(x: string): any; + +/** + * Converts A string to an integer. + * @param s A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. + */ +declare function parseInt(s: string, radix?: number): number; + +/** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ +declare function parseFloat(string: string): number; + +/** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a number). + * @param number A numeric value. + */ +declare function isNaN(number: number): boolean; + +/** + * Determines whether a supplied number is finite. + * @param number Any numeric value. + */ +declare function isFinite(number: number): boolean; + +/** + * Gets the unencoded version of an encoded Uniform Resource Identifier (URI). + * @param encodedURI A value representing an encoded URI. + */ +declare function decodeURI(encodedURI: string): string; + +/** + * Gets the unencoded version of an encoded component of a Uniform Resource Identifier (URI). + * @param encodedURIComponent A value representing an encoded URI component. + */ +declare function decodeURIComponent(encodedURIComponent: string): string; + +/** + * Encodes a text string as a valid Uniform Resource Identifier (URI) + * @param uri A value representing an encoded URI. + */ +declare function encodeURI(uri: string): string; + +/** + * Encodes a text string as a valid component of a Uniform Resource Identifier (URI). + * @param uriComponent A value representing an encoded URI component. + */ +declare function encodeURIComponent(uriComponent: string): string; + +interface PropertyDescriptor { + configurable?: boolean; + enumerable?: boolean; + value?: any; + writable?: boolean; + get? (): any; + set? (v: any): void; +} + +interface PropertyDescriptorMap { + [s: string]: PropertyDescriptor; +} + +interface Object { + /** The initial value of Object.prototype.constructor is the standard built-in Object constructor. */ + constructor: Function; + + /** Returns a string representation of an object. */ + toString(): string; + + /** Returns a date converted to a string using the current locale. */ + toLocaleString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Object; + + /** + * Determines whether an object has a property with the specified name. + * @param v A property name. + */ + hasOwnProperty(v: string): boolean; + + /** + * Determines whether an object exists in another object's prototype chain. + * @param v Another object whose prototype chain is to be checked. + */ + isPrototypeOf(v: Object): boolean; + + /** + * Determines whether a specified property is enumerable. + * @param v A property name. + */ + propertyIsEnumerable(v: string): boolean; +} + +interface ObjectConstructor { + new (value?: any): Object; + (): any; + (value: any): any; + + /** A reference to the prototype for a class of objects. */ + prototype: Object; + + /** + * Returns the prototype of an object. + * @param o The object that references the prototype. + */ + getPrototypeOf(o: any): any; + + /** + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor(o: any, p: string): PropertyDescriptor; + + /** + * Returns the names of the own properties of an object. The own properties of an object are those that are defined directly + * on that object, and are not inherited from the object's prototype. The properties of an object include both fields (objects) and functions. + * @param o Object that contains the own properties. + */ + getOwnPropertyNames(o: any): string[]; + + /** + * Creates an object that has the specified prototype, and that optionally contains specified properties. + * @param o Object to use as a prototype. May be null + * @param properties JavaScript object that contains one or more property descriptors. + */ + create(o: any, properties?: PropertyDescriptorMap): any; + + /** + * Adds a property to an object, or modifies attributes of an existing property. + * @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. + * @param p The property name. + * @param attributes Descriptor for the property. It can be for a data property or an accessor property. + */ + defineProperty(o: any, p: string, attributes: PropertyDescriptor): any; + + /** + * Adds one or more properties to an object, and/or modifies attributes of existing properties. + * @param o Object on which to add or modify the properties. This can be a native JavaScript object or a DOM object. + * @param properties JavaScript object that contains one or more descriptor objects. Each descriptor object describes a data property or an accessor property. + */ + defineProperties(o: any, properties: PropertyDescriptorMap): any; + + /** + * Prevents the modification of attributes of existing properties, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + seal(o: T): T; + + /** + * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. + * @param o Object on which to lock the attributes. + */ + freeze(o: T): T; + + /** + * Prevents the addition of new properties to an object. + * @param o Object to make non-extensible. + */ + preventExtensions(o: T): T; + + /** + * Returns true if existing property attributes cannot be modified in an object and new properties cannot be added to the object. + * @param o Object to test. + */ + isSealed(o: any): boolean; + + /** + * Returns true if existing property attributes and values cannot be modified in an object, and new properties cannot be added to the object. + * @param o Object to test. + */ + isFrozen(o: any): boolean; + + /** + * Returns a value that indicates whether new properties can be added to an object. + * @param o Object to test. + */ + isExtensible(o: any): boolean; + + /** + * Returns the names of the enumerable properties and methods of an object. + * @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. + */ + keys(o: any): string[]; +} + +/** + * Provides functionality common to all JavaScript objects. + */ +declare var Object: ObjectConstructor; + +/** + * Creates a new function. + */ +interface Function { + /** + * Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function. + * @param thisArg The object to be used as the this object. + * @param argArray A set of arguments to be passed to the function. + */ + apply(thisArg: any, argArray?: any): any; + + /** + * Calls a method of an object, substituting another object for the current object. + * @param thisArg The object to be used as the current object. + * @param argArray A list of arguments to be passed to the method. + */ + call(thisArg: any, ...argArray: any[]): any; + + /** + * For a given function, creates a bound function that has the same body as the original function. + * The this object of the bound function is associated with the specified object, and has the specified initial parameters. + * @param thisArg An object to which the this keyword can refer inside the new function. + * @param argArray A list of arguments to be passed to the new function. + */ + bind(thisArg: any, ...argArray: any[]): any; + + prototype: any; + length: number; + + // Non-standard extensions + arguments: any; + caller: Function; +} + +interface FunctionConstructor { + /** + * Creates a new function. + * @param args A list of arguments the function accepts. + */ + new (...args: string[]): Function; + (...args: string[]): Function; + prototype: Function; +} + +declare var Function: FunctionConstructor; + +interface IArguments { + [index: number]: any; + length: number; + callee: Function; +} + +interface String { + /** Returns a string representation of a string. */ + toString(): string; + + /** + * Returns the character at the specified index. + * @param pos The zero-based index of the desired character. + */ + charAt(pos: number): string; + + /** + * Returns the Unicode value of the character at the specified location. + * @param index The zero-based index of the desired character. If there is no character at the specified index, NaN is returned. + */ + charCodeAt(index: number): number; + + /** + * Returns a string that contains the concatenation of two or more strings. + * @param strings The strings to append to the end of the string. + */ + concat(...strings: string[]): string; + + /** + * Returns the position of the first occurrence of a substring. + * @param searchString The substring to search for in the string + * @param position The index at which to begin searching the String object. If omitted, search starts at the beginning of the string. + */ + indexOf(searchString: string, position?: number): number; + + /** + * Returns the last occurrence of a substring in the string. + * @param searchString The substring to search for. + * @param position The index at which to begin searching. If omitted, the search begins at the end of the string. + */ + lastIndexOf(searchString: string, position?: number): number; + + /** + * Determines whether two strings are equivalent in the current locale. + * @param that String to compare to target string + */ + localeCompare(that: string): number; + + /** + * Matches a string with a regular expression, and returns an array containing the results of that search. + * @param regexp A variable name or string literal containing the regular expression pattern and flags. + */ + match(regexp: string): RegExpMatchArray; + + /** + * Matches a string with a regular expression, and returns an array containing the results of that search. + * @param regexp A regular expression object that contains the regular expression pattern and applicable flags. + */ + match(regexp: RegExp): RegExpMatchArray; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A string that represents the regular expression. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replace(searchValue: string, replaceValue: string): string; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A string that represents the regular expression. + * @param replacer A function that returns the replacement text. + */ + replace(searchValue: string, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replace(searchValue: RegExp, replaceValue: string): string; + + /** + * Replaces text in a string, using a regular expression or search string. + * @param searchValue A Regular Expression object containing the regular expression pattern and applicable flags + * @param replacer A function that returns the replacement text. + */ + replace(searchValue: RegExp, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the first substring match in a regular expression search. + * @param regexp The regular expression pattern and applicable flags. + */ + search(regexp: string): number; + + /** + * Finds the first substring match in a regular expression search. + * @param regexp The regular expression pattern and applicable flags. + */ + search(regexp: RegExp): number; + + /** + * Returns a section of a string. + * @param start The index to the beginning of the specified portion of stringObj. + * @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. + * If this value is not specified, the substring continues to the end of stringObj. + */ + slice(start?: number, end?: number): string; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @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. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(separator: string, limit?: number): string[]; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param separator A Regular Express that identifies character or characters to use in separating the string. If omitted, a single-element array containing the entire string is returned. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(separator: RegExp, limit?: number): string[]; + + /** + * Returns the substring at the specified location within a String object. + * @param start The zero-based index number indicating the beginning of the substring. + * @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. + * If end is omitted, the characters from start through the end of the original string are returned. + */ + substring(start: number, end?: number): string; + + /** Converts all the alphabetic characters in a string to lowercase. */ + toLowerCase(): string; + + /** Converts all alphabetic characters to lowercase, taking into account the host environment's current locale. */ + toLocaleLowerCase(): string; + + /** Converts all the alphabetic characters in a string to uppercase. */ + toUpperCase(): string; + + /** Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale. */ + toLocaleUpperCase(): string; + + /** Removes the leading and trailing white space and line terminator characters from a string. */ + trim(): string; + + /** Returns the length of a String object. */ + length: number; + + // IE extensions + /** + * Gets a substring beginning at the specified location and having the specified length. + * @param from The starting position of the desired substring. The index of the first character in the string is zero. + * @param length The number of characters to include in the returned substring. + */ + substr(from: number, length?: number): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): string; + + [index: number]: string; +} + +interface StringConstructor { + new (value?: any): String; + (value?: any): string; + prototype: String; + fromCharCode(...codes: number[]): string; +} + +/** + * Allows manipulation and formatting of text strings and determination and location of substrings within strings. + */ +declare var String: StringConstructor; + +interface Boolean { + /** Returns the primitive value of the specified object. */ + valueOf(): boolean; +} + +interface BooleanConstructor { + new (value?: any): Boolean; + (value?: any): boolean; + prototype: Boolean; +} + +declare var Boolean: BooleanConstructor; + +interface Number { + /** + * Returns a string representation of an object. + * @param radix Specifies a radix for converting numeric values to strings. This value is only used for numbers. + */ + toString(radix?: number): string; + + /** + * Returns a string representing a number in fixed-point notation. + * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. + */ + toFixed(fractionDigits?: number): string; + + /** + * Returns a string containing a number represented in exponential notation. + * @param fractionDigits Number of digits after the decimal point. Must be in the range 0 - 20, inclusive. + */ + toExponential(fractionDigits?: number): string; + + /** + * Returns a string containing a number represented either in exponential or fixed-point notation with a specified number of digits. + * @param precision Number of significant digits. Must be in the range 1 - 21, inclusive. + */ + toPrecision(precision?: number): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): number; +} + +interface NumberConstructor { + new (value?: any): Number; + (value?: any): number; + prototype: Number; + + /** The largest number that can be represented in JavaScript. Equal to approximately 1.79E+308. */ + MAX_VALUE: number; + + /** The closest number to zero that can be represented in JavaScript. Equal to approximately 5.00E-324. */ + MIN_VALUE: number; + + /** + * A value that is not a number. + * In equality comparisons, NaN does not equal any value, including itself. To test whether a value is equivalent to NaN, use the isNaN function. + */ + NaN: number; + + /** + * A value that is less than the largest negative number that can be represented in JavaScript. + * JavaScript displays NEGATIVE_INFINITY values as -infinity. + */ + NEGATIVE_INFINITY: number; + + /** + * A value greater than the largest number that can be represented in JavaScript. + * JavaScript displays POSITIVE_INFINITY values as infinity. + */ + POSITIVE_INFINITY: number; +} + +/** An object that represents a number of any kind. All JavaScript numbers are 64-bit floating-point numbers. */ +declare var Number: NumberConstructor; + +interface TemplateStringsArray extends Array { + raw: string[]; +} + +interface Math { + /** The mathematical constant e. This is Euler's number, the base of natural logarithms. */ + E: number; + /** The natural logarithm of 10. */ + LN10: number; + /** The natural logarithm of 2. */ + LN2: number; + /** The base-2 logarithm of e. */ + LOG2E: number; + /** The base-10 logarithm of e. */ + LOG10E: number; + /** Pi. This is the ratio of the circumference of a circle to its diameter. */ + PI: number; + /** The square root of 0.5, or, equivalently, one divided by the square root of 2. */ + SQRT1_2: number; + /** The square root of 2. */ + SQRT2: number; + /** + * Returns the absolute value of a number (the value without regard to whether it is positive or negative). + * For example, the absolute value of -5 is the same as the absolute value of 5. + * @param x A numeric expression for which the absolute value is needed. + */ + abs(x: number): number; + /** + * Returns the arc cosine (or inverse cosine) of a number. + * @param x A numeric expression. + */ + acos(x: number): number; + /** + * Returns the arcsine of a number. + * @param x A numeric expression. + */ + asin(x: number): number; + /** + * Returns the arctangent of a number. + * @param x A numeric expression for which the arctangent is needed. + */ + atan(x: number): number; + /** + * Returns the angle (in radians) from the X axis to a point. + * @param y A numeric expression representing the cartesian y-coordinate. + * @param x A numeric expression representing the cartesian x-coordinate. + */ + atan2(y: number, x: number): number; + /** + * Returns the smallest number greater than or equal to its numeric argument. + * @param x A numeric expression. + */ + ceil(x: number): number; + /** + * Returns the cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cos(x: number): number; + /** + * Returns e (the base of natural logarithms) raised to a power. + * @param x A numeric expression representing the power of e. + */ + exp(x: number): number; + /** + * Returns the greatest number less than or equal to its numeric argument. + * @param x A numeric expression. + */ + floor(x: number): number; + /** + * Returns the natural logarithm (base e) of a number. + * @param x A numeric expression. + */ + log(x: number): number; + /** + * Returns the larger of a set of supplied numeric expressions. + * @param values Numeric expressions to be evaluated. + */ + max(...values: number[]): number; + /** + * Returns the smaller of a set of supplied numeric expressions. + * @param values Numeric expressions to be evaluated. + */ + min(...values: number[]): number; + /** + * Returns the value of a base expression taken to a specified power. + * @param x The base value of the expression. + * @param y The exponent value of the expression. + */ + pow(x: number, y: number): number; + /** Returns a pseudorandom number between 0 and 1. */ + random(): number; + /** + * Returns a supplied numeric expression rounded to the nearest number. + * @param x The value to be rounded to the nearest number. + */ + round(x: number): number; + /** + * Returns the sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sin(x: number): number; + /** + * Returns the square root of a number. + * @param x A numeric expression. + */ + sqrt(x: number): number; + /** + * Returns the tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tan(x: number): number; +} +/** An intrinsic object that provides basic mathematics functionality and constants. */ +declare var Math: Math; + +/** Enables basic storage and retrieval of dates and times. */ +interface Date { + /** Returns a string representation of a date. The format of the string depends on the locale. */ + toString(): string; + /** Returns a date as a string value. */ + toDateString(): string; + /** Returns a time as a string value. */ + toTimeString(): string; + /** Returns a value as a string value appropriate to the host environment's current locale. */ + toLocaleString(): string; + /** Returns a date as a string value appropriate to the host environment's current locale. */ + toLocaleDateString(): string; + /** Returns a time as a string value appropriate to the host environment's current locale. */ + toLocaleTimeString(): string; + /** Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC. */ + valueOf(): number; + /** Gets the time value in milliseconds. */ + getTime(): number; + /** Gets the year, using local time. */ + getFullYear(): number; + /** Gets the year using Universal Coordinated Time (UTC). */ + getUTCFullYear(): number; + /** Gets the month, using local time. */ + getMonth(): number; + /** Gets the month of a Date object using Universal Coordinated Time (UTC). */ + getUTCMonth(): number; + /** Gets the day-of-the-month, using local time. */ + getDate(): number; + /** Gets the day-of-the-month, using Universal Coordinated Time (UTC). */ + getUTCDate(): number; + /** Gets the day of the week, using local time. */ + getDay(): number; + /** Gets the day of the week using Universal Coordinated Time (UTC). */ + getUTCDay(): number; + /** Gets the hours in a date, using local time. */ + getHours(): number; + /** Gets the hours value in a Date object using Universal Coordinated Time (UTC). */ + getUTCHours(): number; + /** Gets the minutes of a Date object, using local time. */ + getMinutes(): number; + /** Gets the minutes of a Date object using Universal Coordinated Time (UTC). */ + getUTCMinutes(): number; + /** Gets the seconds of a Date object, using local time. */ + getSeconds(): number; + /** Gets the seconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCSeconds(): number; + /** Gets the milliseconds of a Date, using local time. */ + getMilliseconds(): number; + /** Gets the milliseconds of a Date object using Universal Coordinated Time (UTC). */ + getUTCMilliseconds(): number; + /** Gets the difference in minutes between the time on the local computer and Universal Coordinated Time (UTC). */ + getTimezoneOffset(): number; + /** + * Sets the date and time value in the Date object. + * @param time A numeric value representing the number of elapsed milliseconds since midnight, January 1, 1970 GMT. + */ + setTime(time: number): number; + /** + * Sets the milliseconds value in the Date object using local time. + * @param ms A numeric value equal to the millisecond value. + */ + setMilliseconds(ms: number): number; + /** + * Sets the milliseconds value in the Date object using Universal Coordinated Time (UTC). + * @param ms A numeric value equal to the millisecond value. + */ + setUTCMilliseconds(ms: number): number; + + /** + * Sets the seconds value in the Date object using local time. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setSeconds(sec: number, ms?: number): number; + /** + * Sets the seconds value in the Date object using Universal Coordinated Time (UTC). + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCSeconds(sec: number, ms?: number): number; + /** + * Sets the minutes value in the Date object using local time. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setMinutes(min: number, sec?: number, ms?: number): number; + /** + * Sets the minutes value in the Date object using Universal Coordinated Time (UTC). + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCMinutes(min: number, sec?: number, ms?: number): number; + /** + * Sets the hour value in the Date object using local time. + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setHours(hours: number, min?: number, sec?: number, ms?: number): number; + /** + * Sets the hours value in the Date object using Universal Coordinated Time (UTC). + * @param hours A numeric value equal to the hours value. + * @param min A numeric value equal to the minutes value. + * @param sec A numeric value equal to the seconds value. + * @param ms A numeric value equal to the milliseconds value. + */ + setUTCHours(hours: number, min?: number, sec?: number, ms?: number): number; + /** + * Sets the numeric day-of-the-month value of the Date object using local time. + * @param date A numeric value equal to the day of the month. + */ + setDate(date: number): number; + /** + * Sets the numeric day of the month in the Date object using Universal Coordinated Time (UTC). + * @param date A numeric value equal to the day of the month. + */ + setUTCDate(date: number): number; + /** + * Sets the month value in the Date object using local time. + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @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. + */ + setMonth(month: number, date?: number): number; + /** + * Sets the month value in the Date object using Universal Coordinated Time (UTC). + * @param month A numeric value equal to the month. The value for January is 0, and other month values follow consecutively. + * @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. + */ + setUTCMonth(month: number, date?: number): number; + /** + * Sets the year of the Date object using local time. + * @param year A numeric value for the year. + * @param month A zero-based numeric value for the month (0 for January, 11 for December). Must be specified if numDate is specified. + * @param date A numeric value equal for the day of the month. + */ + setFullYear(year: number, month?: number, date?: number): number; + /** + * Sets the year value in the Date object using Universal Coordinated Time (UTC). + * @param year A numeric value equal to the year. + * @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. + * @param date A numeric value equal to the day of the month. + */ + setUTCFullYear(year: number, month?: number, date?: number): number; + /** Returns a date converted to a string using Universal Coordinated Time (UTC). */ + toUTCString(): string; + /** Returns a date as a string value in ISO format. */ + toISOString(): string; + /** Used by the JSON.stringify method to enable the transformation of an object's data for JavaScript Object Notation (JSON) serialization. */ + toJSON(key?: any): string; +} + +interface DateConstructor { + new (): Date; + new (value: number): Date; + new (value: string): Date; + new (year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; + (): string; + prototype: Date; + /** + * Parses a string containing a date, and returns the number of milliseconds between that date and midnight, January 1, 1970. + * @param s A date string + */ + parse(s: string): number; + /** + * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. + * @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. + * @param month The month as an number between 0 and 11 (January to December). + * @param date The date as an number between 1 and 31. + * @param hours Must be supplied if minutes is supplied. An number from 0 to 23 (midnight to 11pm) that specifies the hour. + * @param minutes Must be supplied if seconds is supplied. An number from 0 to 59 that specifies the minutes. + * @param seconds Must be supplied if milliseconds is supplied. An number from 0 to 59 that specifies the seconds. + * @param ms An number from 0 to 999 that specifies the milliseconds. + */ + UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; + now(): number; +} + +declare var Date: DateConstructor; + +interface RegExpMatchArray extends Array { + index?: number; + input?: string; +} + +interface RegExpExecArray extends Array { + index: number; + input: string; +} + +interface RegExp { + /** + * Executes a search on a string using a regular expression pattern, and returns an array containing the results of that search. + * @param string The String object or string literal on which to perform the search. + */ + exec(string: string): RegExpExecArray; + + /** + * Returns a Boolean value that indicates whether or not a pattern exists in a searched string. + * @param string String on which to perform the search. + */ + test(string: string): boolean; + + /** 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. */ + source: string; + + /** Returns a Boolean value indicating the state of the global flag (g) used with a regular expression. Default is false. Read-only. */ + global: boolean; + + /** Returns a Boolean value indicating the state of the ignoreCase flag (i) used with a regular expression. Default is false. Read-only. */ + ignoreCase: boolean; + + /** Returns a Boolean value indicating the state of the multiline flag (m) used with a regular expression. Default is false. Read-only. */ + multiline: boolean; + + lastIndex: number; + + // Non-standard extensions + compile(): RegExp; +} + +interface RegExpConstructor { + new (pattern: string, flags?: string): RegExp; + (pattern: string, flags?: string): RegExp; + prototype: RegExp; + + // Non-standard extensions + $1: string; + $2: string; + $3: string; + $4: string; + $5: string; + $6: string; + $7: string; + $8: string; + $9: string; + lastMatch: string; +} + +declare var RegExp: RegExpConstructor; + +interface Error { + name: string; + message: string; +} + +interface ErrorConstructor { + new (message?: string): Error; + (message?: string): Error; + prototype: Error; +} + +declare var Error: ErrorConstructor; + +interface EvalError extends Error { +} + +interface EvalErrorConstructor { + new (message?: string): EvalError; + (message?: string): EvalError; + prototype: EvalError; +} + +declare var EvalError: EvalErrorConstructor; + +interface RangeError extends Error { +} + +interface RangeErrorConstructor { + new (message?: string): RangeError; + (message?: string): RangeError; + prototype: RangeError; +} + +declare var RangeError: RangeErrorConstructor; + +interface ReferenceError extends Error { +} + +interface ReferenceErrorConstructor { + new (message?: string): ReferenceError; + (message?: string): ReferenceError; + prototype: ReferenceError; +} + +declare var ReferenceError: ReferenceErrorConstructor; + +interface SyntaxError extends Error { +} + +interface SyntaxErrorConstructor { + new (message?: string): SyntaxError; + (message?: string): SyntaxError; + prototype: SyntaxError; +} + +declare var SyntaxError: SyntaxErrorConstructor; + +interface TypeError extends Error { +} + +interface TypeErrorConstructor { + new (message?: string): TypeError; + (message?: string): TypeError; + prototype: TypeError; +} + +declare var TypeError: TypeErrorConstructor; + +interface URIError extends Error { +} + +interface URIErrorConstructor { + new (message?: string): URIError; + (message?: string): URIError; + prototype: URIError; +} + +declare var URIError: URIErrorConstructor; + +interface JSON { + /** + * Converts a JavaScript Object Notation (JSON) string into an object. + * @param text A valid JSON string. + * @param reviver A function that transforms the results. This function is called for each member of the object. + * If a member contains nested objects, the nested objects are transformed before the parent object is. + */ + parse(text: string, reviver?: (key: any, value: any) => any): any; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + */ + stringify(value: any): string; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer A function that transforms the results. + */ + stringify(value: any, replacer: (key: string, value: any) => any): string; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer Array that transforms the results. + */ + stringify(value: any, replacer: any[]): string; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer A function that transforms the results. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + */ + stringify(value: any, replacer: (key: string, value: any) => any, space: string | number): string; + /** + * Converts a JavaScript value to a JavaScript Object Notation (JSON) string. + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer Array that transforms the results. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + */ + stringify(value: any, replacer: any[], space: string | number): string; +} +/** + * An intrinsic object that provides functions to convert JavaScript values to and from the JavaScript Object Notation (JSON) format. + */ +declare var JSON: JSON; + + +///////////////////////////// +/// ECMAScript Array API (specially handled by compiler) +///////////////////////////// + +interface Array { + /** + * Gets or sets the length of the array. This is a number one higher than the highest element defined in an array. + */ + length: number; + /** + * Returns a string representation of an array. + */ + toString(): string; + toLocaleString(): string; + /** + * Appends new elements to an array, and returns the new length of the array. + * @param items New elements of the Array. + */ + push(...items: T[]): number; + /** + * Removes the last element from an array and returns it. + */ + pop(): T; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: U[]): T[]; + /** + * Combines two or more arrays. + * @param items Additional items to add to the end of array1. + */ + concat(...items: T[]): T[]; + /** + * Adds all the elements of an array separated by the specified separator string. + * @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. + */ + join(separator?: string): string; + /** + * Reverses the elements in an Array. + */ + reverse(): T[]; + /** + * Removes the first element from an array and returns it. + */ + shift(): T; + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): T[]; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: T, b: T) => number): T[]; + + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + */ + splice(start: number): T[]; + + /** + * Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. + * @param start The zero-based location in the array from which to start removing elements. + * @param deleteCount The number of elements to remove. + * @param items Elements to insert into the array in place of the deleted elements. + */ + splice(start: number, deleteCount: number, ...items: T[]): T[]; + + /** + * Inserts new elements at the start of an array. + * @param items Elements to insert at the start of the Array. + */ + unshift(...items: T[]): number; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0. + */ + indexOf(searchElement: T, fromIndex?: number): number; + + /** + * Returns the index of the last occurrence of a specified value in an array. + * @param searchElement The value to locate in the array. + * @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. + */ + lastIndexOf(searchElement: T, fromIndex?: number): number; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array. + * @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. + */ + every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array. + * @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. + */ + some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. + * @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. + */ + forEach(callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void; + + /** + * Calls a defined callback function on each element of an array, and returns an array that contains the results. + * @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. + * @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. + */ + map(callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[]; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array. + * @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. + */ + filter(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[]; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T; + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U; + + [n: number]: T; +} + +interface ArrayConstructor { + new (arrayLength?: number): any[]; + new (arrayLength: number): T[]; + new (...items: T[]): T[]; + (arrayLength?: number): any[]; + (arrayLength: number): T[]; + (...items: T[]): T[]; + isArray(arg: any): arg is Array; + prototype: Array; +} + +declare var Array: ArrayConstructor; + +interface TypedPropertyDescriptor { + enumerable?: boolean; + configurable?: boolean; + writable?: boolean; + value?: T; + get?: () => T; + set?: (value: T) => void; +} + +declare type ClassDecorator = (target: TFunction) => TFunction | void; +declare type PropertyDecorator = (target: Object, propertyKey: string | symbol) => void; +declare type MethodDecorator = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor) => TypedPropertyDescriptor | void; +declare type ParameterDecorator = (target: Object, propertyKey: string | symbol, parameterIndex: number) => void; + +declare type PromiseConstructorLike = new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void) => PromiseLike; + +interface PromiseLike { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): PromiseLike; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): PromiseLike; +} + +interface ArrayLike { + length: number; + [n: number]: T; +} + + +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { + /** + * Read-only. The length of the ArrayBuffer (in bytes). + */ + byteLength: number; + + /** + * Returns a section of an ArrayBuffer. + */ + slice(begin:number, end?:number): ArrayBuffer; +} + +interface ArrayBufferConstructor { + prototype: ArrayBuffer; + new (byteLength: number): ArrayBuffer; + isView(arg: any): boolean; +} +declare var ArrayBuffer: ArrayBufferConstructor; + +interface ArrayBufferView { + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; +} + +interface DataView { + buffer: ArrayBuffer; + byteLength: number; + byteOffset: number; + /** + * Gets the Float32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Float64 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getFloat64(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Int8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt8(byteOffset: number): number; + + /** + * Gets the Int16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt16(byteOffset: number, littleEndian?: boolean): number; + /** + * Gets the Int32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getInt32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Uint8 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint8(byteOffset: number): number; + + /** + * Gets the Uint16 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint16(byteOffset: number, littleEndian?: boolean): number; + + /** + * Gets the Uint32 value at the specified byte offset from the start of the view. There is + * no alignment constraint; multi-byte values may be fetched from any offset. + * @param byteOffset The place in the buffer at which the value should be retrieved. + */ + getUint32(byteOffset: number, littleEndian?: boolean): number; + + /** + * Stores an Float32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat32(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Float64 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setFloat64(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Int8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setInt8(byteOffset: number, value: number): void; + + /** + * Stores an Int16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt16(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Int32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setInt32(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Uint8 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + */ + setUint8(byteOffset: number, value: number): void; + + /** + * Stores an Uint16 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint16(byteOffset: number, value: number, littleEndian?: boolean): void; + + /** + * Stores an Uint32 value at the specified byte offset from the start of the view. + * @param byteOffset The place in the buffer at which the value should be set. + * @param value The value to set. + * @param littleEndian If false or undefined, a big-endian value should be written, + * otherwise a little-endian value should be written. + */ + setUint32(byteOffset: number, value: number, littleEndian?: boolean): void; +} + +interface DataViewConstructor { + new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView; +} +declare var DataView: DataViewConstructor; + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Int8Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @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. + */ + every(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Int8Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @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. + */ + filter(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): Int8Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @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. + */ + forEach(callbackfn: (value: number, index: number, array: Int8Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @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. + * @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. + */ + map(callbackfn: (value: number, index: number, array: Int8Array) => number, thisArg?: any): Int8Array; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int8Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int8Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int8Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int8Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @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. + */ + some(callbackfn: (value: number, index: number, array: Int8Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Int8Array; + + /** + * Gets a new Int8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int8Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} +interface Int8ArrayConstructor { + prototype: Int8Array; + new (length: number): Int8Array; + new (array: ArrayLike): Int8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int8Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; + +} +declare var Int8Array: Int8ArrayConstructor; + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Uint8Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @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. + */ + every(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Uint8Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @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. + */ + filter(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): Uint8Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @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. + */ + forEach(callbackfn: (value: number, index: number, array: Uint8Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @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. + * @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. + */ + map(callbackfn: (value: number, index: number, array: Uint8Array) => number, thisArg?: any): Uint8Array; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint8Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint8Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @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. + */ + some(callbackfn: (value: number, index: number, array: Uint8Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Uint8Array; + + /** + * Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint8Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint8ArrayConstructor { + prototype: Uint8Array; + new (length: number): Uint8Array; + new (array: ArrayLike): Uint8Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; + +} +declare var Uint8Array: Uint8ArrayConstructor; + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Uint8ClampedArray; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @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. + */ + every(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Uint8ClampedArray; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @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. + */ + filter(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): Uint8ClampedArray; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @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. + */ + forEach(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @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. + * @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. + */ + map(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => number, thisArg?: any): Uint8ClampedArray; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint8ClampedArray) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint8ClampedArray; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: Uint8ClampedArray, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint8ClampedArray; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @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. + */ + some(callbackfn: (value: number, index: number, array: Uint8ClampedArray) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Uint8ClampedArray; + + /** + * Gets a new Uint8ClampedArray view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint8ClampedArray; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint8ClampedArrayConstructor { + prototype: Uint8ClampedArray; + new (length: number): Uint8ClampedArray; + new (array: ArrayLike): Uint8ClampedArray; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint8ClampedArray; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint8ClampedArray; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; +} +declare var Uint8ClampedArray: Uint8ClampedArrayConstructor; + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Int16Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @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. + */ + every(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Int16Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @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. + */ + filter(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): Int16Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @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. + */ + forEach(callbackfn: (value: number, index: number, array: Int16Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @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. + * @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. + */ + map(callbackfn: (value: number, index: number, array: Int16Array) => number, thisArg?: any): Int16Array; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int16Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int16Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int16Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int16Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @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. + */ + some(callbackfn: (value: number, index: number, array: Int16Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Int16Array; + + /** + * Gets a new Int16Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int16Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Int16ArrayConstructor { + prototype: Int16Array; + new (length: number): Int16Array; + new (array: ArrayLike): Int16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int16Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; + +} +declare var Int16Array: Int16ArrayConstructor; + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Uint16Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @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. + */ + every(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Uint16Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @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. + */ + filter(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): Uint16Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @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. + */ + forEach(callbackfn: (value: number, index: number, array: Uint16Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @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. + * @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. + */ + map(callbackfn: (value: number, index: number, array: Uint16Array) => number, thisArg?: any): Uint16Array; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint16Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint16Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint16Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint16Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @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. + */ + some(callbackfn: (value: number, index: number, array: Uint16Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Uint16Array; + + /** + * Gets a new Uint16Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint16Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint16ArrayConstructor { + prototype: Uint16Array; + new (length: number): Uint16Array; + new (array: ArrayLike): Uint16Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint16Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; + +} +declare var Uint16Array: Uint16ArrayConstructor; +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Int32Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @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. + */ + every(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Int32Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @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. + */ + filter(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): Int32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @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. + */ + forEach(callbackfn: (value: number, index: number, array: Int32Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @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. + * @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. + */ + map(callbackfn: (value: number, index: number, array: Int32Array) => number, thisArg?: any): Int32Array; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Int32Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Int32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Int32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Int32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @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. + */ + some(callbackfn: (value: number, index: number, array: Int32Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Int32Array; + + /** + * Gets a new Int32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Int32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Int32ArrayConstructor { + prototype: Int32Array; + new (length: number): Int32Array; + new (array: ArrayLike): Int32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Int32Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Int32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; +} +declare var Int32Array: Int32ArrayConstructor; + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Uint32Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @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. + */ + every(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Uint32Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @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. + */ + filter(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): Uint32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @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. + */ + forEach(callbackfn: (value: number, index: number, array: Uint32Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @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. + * @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. + */ + map(callbackfn: (value: number, index: number, array: Uint32Array) => number, thisArg?: any): Uint32Array; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Uint32Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Uint32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Uint32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Uint32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @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. + */ + some(callbackfn: (value: number, index: number, array: Uint32Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Uint32Array; + + /** + * Gets a new Uint32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Uint32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Uint32ArrayConstructor { + prototype: Uint32Array; + new (length: number): Uint32Array; + new (array: ArrayLike): Uint32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Uint32Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Uint32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; +} +declare var Uint32Array: Uint32ArrayConstructor; + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Float32Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @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. + */ + every(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Float32Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @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. + */ + filter(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): Float32Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @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. + */ + forEach(callbackfn: (value: number, index: number, array: Float32Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @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. + * @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. + */ + map(callbackfn: (value: number, index: number, array: Float32Array) => number, thisArg?: any): Float32Array; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float32Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float32Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Float32Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Float32Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @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. + */ + some(callbackfn: (value: number, index: number, array: Float32Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Float32Array; + + /** + * Gets a new Float32Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Float32Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Float32ArrayConstructor { + prototype: Float32Array; + new (length: number): Float32Array; + new (array: ArrayLike): Float32Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float32Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; + +} +declare var Float32Array: Float32ArrayConstructor; + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * The ArrayBuffer instance referenced by the array. + */ + buffer: ArrayBuffer; + + /** + * The length in bytes of the array. + */ + byteLength: number; + + /** + * The offset in bytes of the array. + */ + byteOffset: number; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): Float64Array; + + /** + * Determines whether all the members of an array satisfy the specified test. + * @param callbackfn A function that accepts up to three arguments. The every method calls + * the callbackfn function for each element in array1 until the callbackfn returns false, + * or until the end of the array. + * @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. + */ + every(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: number, start?: number, end?: number): Float64Array; + + /** + * Returns the elements of an array that meet the condition specified in a callback function. + * @param callbackfn A function that accepts up to three arguments. The filter method calls + * the callbackfn function one time for each element in the array. + * @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. + */ + filter(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): Float64Array; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: number, index: number, obj: Array) => boolean, thisArg?: any): number; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: number) => boolean, thisArg?: any): number; + + /** + * Performs the specified action for each element in an array. + * @param callbackfn A function that accepts up to three arguments. forEach calls the + * callbackfn function one time for each element in the array. + * @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. + */ + forEach(callbackfn: (value: number, index: number, array: Float64Array) => void, thisArg?: any): void; + + /** + * Returns the index of the first occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + indexOf(searchElement: number, fromIndex?: number): number; + + /** + * Adds all the elements of an array separated by the specified separator string. + * @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. + */ + join(separator?: string): string; + + /** + * Returns the index of the last occurrence of a value in an array. + * @param searchElement The value to locate in the array. + * @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the + * search starts at index 0. + */ + lastIndexOf(searchElement: number, fromIndex?: number): number; + + /** + * The length of the array. + */ + length: number; + + /** + * Calls a defined callback function on each element of an array, and returns an array that + * contains the results. + * @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. + * @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. + */ + map(callbackfn: (value: number, index: number, array: Float64Array) => number, thisArg?: any): Float64Array; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduce(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: number, currentValue: number, currentIndex: number, array: Float64Array) => number, initialValue?: number): number; + + /** + * 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. + * @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. + * @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. + */ + reduceRight(callbackfn: (previousValue: U, currentValue: number, currentIndex: number, array: Float64Array) => U, initialValue: U): U; + + /** + * Reverses the elements in an Array. + */ + reverse(): Float64Array; + + /** + * Sets a value or an array of values. + * @param index The index of the location to set. + * @param value The value to set. + */ + set(index: number, value: number): void; + + /** + * Sets a value or an array of values. + * @param array A typed or untyped array of values to set. + * @param offset The index in the current array at which the values are to be written. + */ + set(array: ArrayLike, offset?: number): void; + + /** + * Returns a section of an array. + * @param start The beginning of the specified portion of the array. + * @param end The end of the specified portion of the array. + */ + slice(start?: number, end?: number): Float64Array; + + /** + * Determines whether the specified callback function returns true for any element of an array. + * @param callbackfn A function that accepts up to three arguments. The some method calls the + * callbackfn function for each element in array1 until the callbackfn returns true, or until + * the end of the array. + * @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. + */ + some(callbackfn: (value: number, index: number, array: Float64Array) => boolean, thisArg?: any): boolean; + + /** + * Sorts an array. + * @param compareFn The name of the function used to determine the order of the elements. If + * omitted, the elements are sorted in ascending, ASCII character order. + */ + sort(compareFn?: (a: number, b: number) => number): Float64Array; + + /** + * Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements + * at begin, inclusive, up to end, exclusive. + * @param begin The index of the beginning of the array. + * @param end The index of the end of the array. + */ + subarray(begin: number, end?: number): Float64Array; + + /** + * Converts a number to a string by using the current locale. + */ + toLocaleString(): string; + + /** + * Returns a string representation of an array. + */ + toString(): string; + + [index: number]: number; +} + +interface Float64ArrayConstructor { + prototype: Float64Array; + new (length: number): Float64Array; + new (array: ArrayLike): Float64Array; + new (buffer: ArrayBuffer, byteOffset?: number, length?: number): Float64Array; + + /** + * The size in bytes of each element in the array. + */ + BYTES_PER_ELEMENT: number; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: number[]): Float64Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; +} +declare var Float64Array: Float64ArrayConstructor; +declare type PropertyKey = string | number | symbol; + +interface Symbol { + /** Returns a string representation of an object. */ + toString(): string; + + /** Returns the primitive value of the specified object. */ + valueOf(): Object; + + [Symbol.toStringTag]: string; +} + +interface SymbolConstructor { + /** + * A reference to the prototype. + */ + prototype: Symbol; + + /** + * Returns a new unique Symbol value. + * @param description Description of the new Symbol object. + */ + (description?: string|number): symbol; + + /** + * Returns a Symbol object from the global symbol registry matching the given key if found. + * Otherwise, returns a new symbol with this key. + * @param key key to search for. + */ + for(key: string): symbol; + + /** + * Returns a key from the global symbol registry matching the given Symbol if found. + * Otherwise, returns a undefined. + * @param sym Symbol to find the key for. + */ + keyFor(sym: symbol): string; + + // Well-known Symbols + + /** + * A method that determines if a constructor object recognizes an object as one of the + * constructor’s instances. Called by the semantics of the instanceof operator. + */ + hasInstance: symbol; + + /** + * A Boolean value that if true indicates that an object should flatten to its array elements + * by Array.prototype.concat. + */ + isConcatSpreadable: symbol; + + /** + * A method that returns the default iterator for an object. Called by the semantics of the + * for-of statement. + */ + iterator: symbol; + + /** + * A regular expression method that matches the regular expression against a string. Called + * by the String.prototype.match method. + */ + match: symbol; + + /** + * A regular expression method that replaces matched substrings of a string. Called by the + * String.prototype.replace method. + */ + replace: symbol; + + /** + * A regular expression method that returns the index within a string that matches the + * regular expression. Called by the String.prototype.search method. + */ + search: symbol; + + /** + * A function valued property that is the constructor function that is used to create + * derived objects. + */ + species: symbol; + + /** + * A regular expression method that splits a string at the indices that match the regular + * expression. Called by the String.prototype.split method. + */ + split: symbol; + + /** + * A method that converts an object to a corresponding primitive value. + * Called by the ToPrimitive abstract operation. + */ + toPrimitive: symbol; + + /** + * A String value that is used in the creation of the default string description of an object. + * Called by the built-in method Object.prototype.toString. + */ + toStringTag: symbol; + + /** + * An Object whose own property names are property names that are excluded from the 'with' + * environment bindings of the associated objects. + */ + unscopables: symbol; +} +declare var Symbol: SymbolConstructor; + +interface Object { + /** + * Determines whether an object has a property with the specified name. + * @param v A property name. + */ + hasOwnProperty(v: PropertyKey): boolean; + + /** + * Determines whether a specified property is enumerable. + * @param v A property name. + */ + propertyIsEnumerable(v: PropertyKey): boolean; +} + +interface ObjectConstructor { + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param sources One or more source objects to copy properties from. + */ + assign(target: any, ...sources: any[]): any; + + /** + * Returns an array of all symbol properties found directly on object o. + * @param o Object to retrieve the symbols from. + */ + getOwnPropertySymbols(o: any): symbol[]; + + /** + * Returns true if the values are the same value, false otherwise. + * @param value1 The first value. + * @param value2 The second value. + */ + is(value1: any, value2: any): boolean; + + /** + * Sets the prototype of a specified object o to object proto or null. Returns the object o. + * @param o The object to change its prototype. + * @param proto The value of the new prototype or null. + */ + setPrototypeOf(o: any, proto: any): any; + + /** + * Gets the own property descriptor of the specified object. + * An own property descriptor is one that is defined directly on the object and is not + * inherited from the object's prototype. + * @param o Object that contains the property. + * @param p Name of the property. + */ + getOwnPropertyDescriptor(o: any, propertyKey: PropertyKey): PropertyDescriptor; + + /** + * Adds a property to an object, or modifies attributes of an existing property. + * @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. + * @param p The property name. + * @param attributes Descriptor for the property. It can be for a data property or an accessor + * property. + */ + defineProperty(o: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): any; +} + +interface Function { + /** + * Returns the name of the function. Function names are read-only and can not be changed. + */ + name: string; + + /** + * Determines whether the given value inherits from this function if this function was used + * as a constructor function. + * + * A constructor function can control which objects are recognized as its instances by + * 'instanceof' by overriding this method. + */ + [Symbol.hasInstance](value: any): boolean; +} + +interface NumberConstructor { + /** + * The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1 + * that is representable as a Number value, which is approximately: + * 2.2204460492503130808472633361816 x 10‍−‍16. + */ + EPSILON: number; + + /** + * Returns true if passed value is finite. + * Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a + * number. Only finite values of the type number, result in true. + * @param number A numeric value. + */ + isFinite(number: number): boolean; + + /** + * Returns true if the value passed is an integer, false otherwise. + * @param number A numeric value. + */ + isInteger(number: number): boolean; + + /** + * Returns a Boolean value that indicates whether a value is the reserved value NaN (not a + * number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter + * to a number. Only values of the type number, that are also NaN, result in true. + * @param number A numeric value. + */ + isNaN(number: number): boolean; + + /** + * Returns true if the value passed is a safe integer. + * @param number A numeric value. + */ + isSafeInteger(number: number): boolean; + + /** + * The value of the largest integer n such that n and n + 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 − 1. + */ + MAX_SAFE_INTEGER: number; + + /** + * The value of the smallest integer n such that n and n − 1 are both exactly representable as + * a Number value. + * The value of Number.MIN_SAFE_INTEGER is −9007199254740991 (−(2^53 − 1)). + */ + MIN_SAFE_INTEGER: number; + + /** + * Converts a string to a floating-point number. + * @param string A string that contains a floating-point number. + */ + parseFloat(string: string): number; + + /** + * Converts A string to an integer. + * @param s A string to convert into a number. + * @param radix A value between 2 and 36 that specifies the base of the number in numString. + * If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal. + * All other strings are considered decimal. + */ + parseInt(string: string, radix?: number): number; +} + +interface Array { + /** Iterator */ + [Symbol.iterator](): IterableIterator; + + /** + * Returns an object whose properties have the value 'true' + * when they will be absent when used in a 'with' statement. + */ + [Symbol.unscopables](): { + copyWithin: boolean; + entries: boolean; + fill: boolean; + find: boolean; + findIndex: boolean; + keys: boolean; + values: boolean; + }; + + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, T]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; + + /** + * Returns the value of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + find(predicate: (value: T, index: number, obj: Array) => boolean, thisArg?: any): T; + + /** + * Returns the index of the first element in the array where predicate is true, and undefined + * otherwise. + * @param predicate find calls predicate once for each element of the array, in ascending + * order, until it finds one where predicate returns true. If such an element is found, find + * immediately returns that element value. Otherwise, find returns undefined. + * @param thisArg If provided, it will be used as the this value for each invocation of + * predicate. If it is not provided, undefined is used instead. + */ + findIndex(predicate: (value: T) => boolean, thisArg?: any): number; + + /** + * Returns the this object after filling the section identified by start and end with value + * @param value value to fill array section with + * @param start index to start filling the array at. If start is negative, it is treated as + * length+start where length is the length of the array. + * @param end index to stop filling the array at. If end is negative, it is treated as + * length+end. + */ + fill(value: T, start?: number, end?: number): T[]; + + /** + * Returns the this object after copying a section of the array identified by start and end + * to the same array starting at position target + * @param target If target is negative, it is treated as length+target where length is the + * length of the array. + * @param start If start is negative, it is treated as length+start. If end is negative, it + * is treated as length+end. + * @param end If not specified, length of the this object is used as its default value. + */ + copyWithin(target: number, start: number, end?: number): T[]; +} + +interface IArguments { + /** Iterator */ + [Symbol.iterator](): IterableIterator; +} + +interface ArrayConstructor { + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: ArrayLike, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(iterable: Iterable, mapfn: (v: T, k: number) => U, thisArg?: any): Array; + + /** + * Creates an array from an array-like object. + * @param arrayLike An array-like object to convert to an array. + */ + from(arrayLike: ArrayLike): Array; + + /** + * Creates an array from an iterable object. + * @param iterable An iterable object to convert to an array. + */ + from(iterable: Iterable): Array; + + /** + * Returns a new array from a set of elements. + * @param items A set of elements to include in the new array object. + */ + of(...items: T[]): Array; +} + +interface String { + /** Iterator */ + [Symbol.iterator](): IterableIterator; + + /** + * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point + * value of the UTF-16 encoded code point starting at the string element at position pos in + * the String resulting from converting this object to a String. + * If there is no element at that position, the result is undefined. + * If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos. + */ + codePointAt(pos: number): number; + + /** + * Returns true if searchString appears as a substring of the result of converting this + * object to a String, at one or more positions that are + * greater than or equal to position; otherwise, returns false. + * @param searchString search string + * @param position If position is undefined, 0 is assumed, so as to search all of the String. + */ + includes(searchString: string, position?: number): boolean; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * endPosition – length(this). Otherwise returns false. + */ + endsWith(searchString: string, endPosition?: number): boolean; + + /** + * Returns the String value result of normalizing the string into the normalization form + * named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms. + * @param form Applicable values: "NFC", "NFD", "NFKC", or "NFKD", If not specified default + * is "NFC" + */ + normalize(form?: string): string; + + /** + * Returns a String value that is made from count copies appended together. If count is 0, + * T is the empty String is returned. + * @param count number of copies to append + */ + repeat(count: number): string; + + /** + * Returns true if the sequence of elements of searchString converted to a String is the + * same as the corresponding elements of this object (converted to a String) starting at + * position. Otherwise returns false. + */ + startsWith(searchString: string, position?: number): boolean; + + // Overloads for objects with methods of well-known symbols. + + /** + * Matches a string an object that supports being matched against, and returns an array containing the results of that search. + * @param matcher An object that supports being matched against. + */ + match(matcher: { [Symbol.match](string: string): RegExpMatchArray; }): RegExpMatchArray; + + /** + * Replaces text in a string, using an object that supports replacement within a string. + * @param searchValue A object can search for and replace matches within a string. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string; + + /** + * Replaces text in a string, using an object that supports replacement within a string. + * @param searchValue A object can search for and replace matches within a string. + * @param replacer A function that returns the replacement text. + */ + replace(searchValue: { [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; }, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the first substring match in a regular expression search. + * @param searcher An object which supports searching within a string. + */ + search(searcher: { [Symbol.search](string: string): number; }): number; + + /** + * Split a string into substrings using the specified separator and return them as an array. + * @param splitter An object that can split a string. + * @param limit A value used to limit the number of elements returned in the array. + */ + split(splitter: { [Symbol.split](string: string, limit?: number): string[]; }, limit?: number): string[]; + + /** + * Returns an HTML anchor element and sets the name attribute to the text value + * @param name + */ + anchor(name: string): string; + + /** Returns a HTML element */ + big(): string; + + /** Returns a HTML element */ + blink(): string; + + /** Returns a HTML element */ + bold(): string; + + /** Returns a HTML element */ + fixed(): string + + /** Returns a HTML element and sets the color attribute value */ + fontcolor(color: string): string + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: number): string; + + /** Returns a HTML element and sets the size attribute value */ + fontsize(size: string): string; + + /** Returns an HTML element */ + italics(): string; + + /** Returns an HTML element and sets the href attribute value */ + link(url: string): string; + + /** Returns a HTML element */ + small(): string; + + /** Returns a HTML element */ + strike(): string; + + /** Returns a HTML element */ + sub(): string; + + /** Returns a HTML element */ + sup(): string; +} + +interface StringConstructor { + /** + * Return the String value whose elements are, in order, the elements in the List elements. + * If length is 0, the empty string is returned. + */ + fromCodePoint(...codePoints: number[]): string; + + /** + * String.raw is intended for use as a tag function of a Tagged Template String. When called + * as such the first argument will be a well formed template call site object and the rest + * parameter will contain the substitution values. + * @param template A well-formed template string call site representation. + * @param substitutions A set of substitution values. + */ + raw(template: TemplateStringsArray, ...substitutions: any[]): string; +} + +interface IteratorResult { + done: boolean; + value?: T; +} + +interface Iterator { + next(value?: any): IteratorResult; + return?(value?: any): IteratorResult; + throw?(e?: any): IteratorResult; +} + +interface Iterable { + [Symbol.iterator](): Iterator; +} + +interface IterableIterator extends Iterator { + [Symbol.iterator](): IterableIterator; +} + +interface GeneratorFunction extends Function { + +} + +interface GeneratorFunctionConstructor { + /** + * Creates a new Generator function. + * @param args A list of arguments the function accepts. + */ + new (...args: string[]): GeneratorFunction; + (...args: string[]): GeneratorFunction; + prototype: GeneratorFunction; +} +declare var GeneratorFunction: GeneratorFunctionConstructor; + +interface Math { + /** + * Returns the number of leading zero bits in the 32-bit binary representation of a number. + * @param x A numeric expression. + */ + clz32(x: number): number; + + /** + * Returns the result of 32-bit multiplication of two numbers. + * @param x First number + * @param y Second number + */ + imul(x: number, y: number): number; + + /** + * Returns the sign of the x, indicating whether x is positive, negative or zero. + * @param x The numeric expression to test + */ + sign(x: number): number; + + /** + * Returns the base 10 logarithm of a number. + * @param x A numeric expression. + */ + log10(x: number): number; + + /** + * Returns the base 2 logarithm of a number. + * @param x A numeric expression. + */ + log2(x: number): number; + + /** + * Returns the natural logarithm of 1 + x. + * @param x A numeric expression. + */ + log1p(x: number): number; + + /** + * Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of + * the natural logarithms). + * @param x A numeric expression. + */ + expm1(x: number): number; + + /** + * Returns the hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + cosh(x: number): number; + + /** + * Returns the hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + sinh(x: number): number; + + /** + * Returns the hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + tanh(x: number): number; + + /** + * Returns the inverse hyperbolic cosine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + acosh(x: number): number; + + /** + * Returns the inverse hyperbolic sine of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + asinh(x: number): number; + + /** + * Returns the inverse hyperbolic tangent of a number. + * @param x A numeric expression that contains an angle measured in radians. + */ + atanh(x: number): number; + + /** + * Returns the square root of the sum of squares of its arguments. + * @param values Values to compute the square root for. + * If no arguments are passed, the result is +0. + * If there is only one argument, the result is the absolute value. + * If any argument is +Infinity or -Infinity, the result is +Infinity. + * If any argument is NaN, the result is NaN. + * If all arguments are either +0 or −0, the result is +0. + */ + hypot(...values: number[] ): number; + + /** + * Returns the integral part of the a numeric expression, x, removing any fractional digits. + * If x is already an integer, the result is x. + * @param x A numeric expression. + */ + trunc(x: number): number; + + /** + * Returns the nearest single precision float representation of a number. + * @param x A numeric expression. + */ + fround(x: number): number; + + /** + * Returns an implementation-dependent approximation to the cube root of number. + * @param x A numeric expression. + */ + cbrt(x: number): number; + + [Symbol.toStringTag]: string; +} + +interface Date { + /** + * Converts a Date object to a string. + */ + [Symbol.toPrimitive](hint: "default"): string; + /** + * Converts a Date object to a string. + */ + [Symbol.toPrimitive](hint: "string"): string; + /** + * Converts a Date object to a number. + */ + [Symbol.toPrimitive](hint: "number"): number; + /** + * Converts a Date object to a string or number. + * + * @param hint The strings "number", "string", or "default" to specify what primitive to return. + * + * @throws {TypeError} If 'hint' was given something other than "number", "string", or "default". + * @returns A number if 'hint' was "number", a string if 'hint' was "string" or "default". + */ + [Symbol.toPrimitive](hint: string): string | number; +} + +interface RegExp { + /** + * Matches a string with this regular expression, and returns an array containing the results of + * that search. + * @param string A string to search within. + */ + [Symbol.match](string: string): RegExpMatchArray; + + /** + * Replaces text in a string, using this regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced + * @param replaceValue A String object or string literal containing the text to replace for every + * successful match of this regular expression. + */ + [Symbol.replace](string: string, replaceValue: string): string; + + /** + * Replaces text in a string, using this regular expression. + * @param string A String object or string literal whose contents matching against + * this regular expression will be replaced + * @param replacer A function that returns the replacement text. + */ + [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string; + + /** + * Finds the position beginning first substring match in a regular expression search + * using this regular expression. + * + * @param string The string to search within. + */ + [Symbol.search](string: string): number; + + /** + * Returns an array of substrings that were delimited by strings in the original input that + * match against this regular expression. + * + * If the regular expression contains capturing parentheses, then each time this + * regular expression matches, the results (including any undefined results) of the + * capturing parentheses are spliced. + * + * @param string string value to split + * @param limit if not undefined, the output array is truncated so that it contains no more + * than 'limit' elements. + */ + [Symbol.split](string: string, limit?: number): string[]; + + /** + * Returns a string indicating the flags of the regular expression in question. This field is read-only. + * The characters in this string are sequenced and concatenated in the following order: + * + * - "g" for global + * - "i" for ignoreCase + * - "m" for multiline + * - "u" for unicode + * - "y" for sticky + * + * If no flags are set, the value is the empty string. + */ + flags: string; + + /** + * Returns a Boolean value indicating the state of the sticky flag (y) used with a regular + * expression. Default is false. Read-only. + */ + sticky: boolean; + + /** + * Returns a Boolean value indicating the state of the Unicode flag (u) used with a regular + * expression. Default is false. Read-only. + */ + unicode: boolean; +} + +interface RegExpConstructor { + [Symbol.species](): RegExpConstructor; +} + +interface Map { + clear(): void; + delete(key: K): boolean; + entries(): IterableIterator<[K, V]>; + forEach(callbackfn: (value: V, index: K, map: Map) => void, thisArg?: any): void; + get(key: K): V; + has(key: K): boolean; + keys(): IterableIterator; + set(key: K, value?: V): Map; + size: number; + values(): IterableIterator; + [Symbol.iterator]():IterableIterator<[K,V]>; + [Symbol.toStringTag]: string; +} + +interface MapConstructor { + new (): Map; + new (): Map; + new (iterable: Iterable<[K, V]>): Map; + prototype: Map; +} +declare var Map: MapConstructor; + +interface WeakMap { + clear(): void; + delete(key: K): boolean; + get(key: K): V; + has(key: K): boolean; + set(key: K, value?: V): WeakMap; + [Symbol.toStringTag]: string; +} + +interface WeakMapConstructor { + new (): WeakMap; + new (): WeakMap; + new (iterable: Iterable<[K, V]>): WeakMap; + prototype: WeakMap; +} +declare var WeakMap: WeakMapConstructor; + +interface Set { + add(value: T): Set; + clear(): void; + delete(value: T): boolean; + entries(): IterableIterator<[T, T]>; + forEach(callbackfn: (value: T, index: T, set: Set) => void, thisArg?: any): void; + has(value: T): boolean; + keys(): IterableIterator; + size: number; + values(): IterableIterator; + [Symbol.iterator]():IterableIterator; + [Symbol.toStringTag]: string; +} + +interface SetConstructor { + new (): Set; + new (): Set; + new (iterable: Iterable): Set; + prototype: Set; +} +declare var Set: SetConstructor; + +interface WeakSet { + add(value: T): WeakSet; + clear(): void; + delete(value: T): boolean; + has(value: T): boolean; + [Symbol.toStringTag]: string; +} + +interface WeakSetConstructor { + new (): WeakSet; + new (): WeakSet; + new (iterable: Iterable): WeakSet; + prototype: WeakSet; +} +declare var WeakSet: WeakSetConstructor; + +interface JSON { + [Symbol.toStringTag]: string; +} + +/** + * Represents a raw buffer of binary data, which is used to store data for the + * different typed arrays. ArrayBuffers cannot be read from or written to directly, + * but can be passed to a typed array or DataView Object to interpret the raw + * buffer as needed. + */ +interface ArrayBuffer { + [Symbol.toStringTag]: string; +} + +interface DataView { + [Symbol.toStringTag]: string; +} + +/** + * A typed array of 8-bit integer values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Int8Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; + [Symbol.iterator](): IterableIterator; +} + +interface Int8ArrayConstructor { + new (elements: Iterable): Int8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int8Array; +} + +/** + * A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; + [Symbol.iterator](): IterableIterator; +} + +interface Uint8ArrayConstructor { + new (elements: Iterable): Uint8Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8Array; +} + +/** + * A typed array of 8-bit unsigned integer (clamped) values. The contents are initialized to 0. + * If the requested number of bytes could not be allocated an exception is raised. + */ +interface Uint8ClampedArray { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; + + [Symbol.iterator](): IterableIterator; +} + +interface Uint8ClampedArrayConstructor { + new (elements: Iterable): Uint8ClampedArray; + + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint8ClampedArray; +} + +/** + * A typed array of 16-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int16Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + + /** + * Returns an list of values in the array + */ + values(): IterableIterator; + + + [Symbol.iterator](): IterableIterator; +} + +interface Int16ArrayConstructor { + new (elements: Iterable): Int16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int16Array; +} + +/** + * A typed array of 16-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint16Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; + [Symbol.iterator](): IterableIterator; +} + +interface Uint16ArrayConstructor { + new (elements: Iterable): Uint16Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint16Array; +} + +/** + * A typed array of 32-bit signed integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Int32Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; + [Symbol.iterator](): IterableIterator; +} + +interface Int32ArrayConstructor { + new (elements: Iterable): Int32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Int32Array; +} + +/** + * A typed array of 32-bit unsigned integer values. The contents are initialized to 0. If the + * requested number of bytes could not be allocated an exception is raised. + */ +interface Uint32Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; + [Symbol.iterator](): IterableIterator; +} + +interface Uint32ArrayConstructor { + new (elements: Iterable): Uint32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Uint32Array; +} + +/** + * A typed array of 32-bit float values. The contents are initialized to 0. If the requested number + * of bytes could not be allocated an exception is raised. + */ +interface Float32Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; + [Symbol.iterator](): IterableIterator; +} + +interface Float32ArrayConstructor { + new (elements: Iterable): Float32Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float32Array; +} + +/** + * A typed array of 64-bit float values. The contents are initialized to 0. If the requested + * number of bytes could not be allocated an exception is raised. + */ +interface Float64Array { + /** + * Returns an array of key, value pairs for every entry in the array + */ + entries(): IterableIterator<[number, number]>; + /** + * Returns an list of keys in the array + */ + keys(): IterableIterator; + /** + * Returns an list of values in the array + */ + values(): IterableIterator; + [Symbol.iterator](): IterableIterator; +} + +interface Float64ArrayConstructor { + new (elements: Iterable): Float64Array; + + /** + * Creates an array from an array-like or iterable object. + * @param arrayLike An array-like or iterable object to convert to an array. + * @param mapfn A mapping function to call on every element of the array. + * @param thisArg Value of 'this' used to invoke the mapfn. + */ + from(arrayLike: Iterable, mapfn?: (v: number, k: number) => number, thisArg?: any): Float64Array; +} + +interface ProxyHandler { + getPrototypeOf? (target: T): any; + setPrototypeOf? (target: T, v: any): boolean; + isExtensible? (target: T): boolean; + preventExtensions? (target: T): boolean; + getOwnPropertyDescriptor? (target: T, p: PropertyKey): PropertyDescriptor; + has? (target: T, p: PropertyKey): boolean; + get? (target: T, p: PropertyKey, receiver: any): any; + set? (target: T, p: PropertyKey, value: any, receiver: any): boolean; + deleteProperty? (target: T, p: PropertyKey): boolean; + defineProperty? (target: T, p: PropertyKey, attributes: PropertyDescriptor): boolean; + enumerate? (target: T): PropertyKey[]; + ownKeys? (target: T): PropertyKey[]; + apply? (target: T, thisArg: any, argArray?: any): any; + construct? (target: T, thisArg: any, argArray?: any): any; +} + +interface ProxyConstructor { + revocable(target: T, handler: ProxyHandler): { proxy: T; revoke: () => void; }; + new (target: T, handler: ProxyHandler): T +} +declare var Proxy: ProxyConstructor; + +declare namespace Reflect { + function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; + function construct(target: Function, argumentsList: ArrayLike, newTarget?: any): any; + function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean; + function deleteProperty(target: any, propertyKey: PropertyKey): boolean; + function enumerate(target: any): IterableIterator; + function get(target: any, propertyKey: PropertyKey, receiver?: any): any; + function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; + function getPrototypeOf(target: any): any; + function has(target: any, propertyKey: string): boolean; + function has(target: any, propertyKey: symbol): boolean; + function isExtensible(target: any): boolean; + function ownKeys(target: any): Array; + function preventExtensions(target: any): boolean; + function set(target: any, propertyKey: PropertyKey, value: any, receiver? :any): boolean; + function setPrototypeOf(target: any, proto: any): boolean; +} + +/** + * Represents the completion of an asynchronous operation + */ +interface Promise { + /** + * Attaches callbacks for the resolution and/or rejection of the Promise. + * @param onfulfilled The callback to execute when the Promise is resolved. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of which ever callback is executed. + */ + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => TResult | PromiseLike): Promise; + then(onfulfilled?: (value: T) => TResult | PromiseLike, onrejected?: (reason: any) => void): Promise; + + /** + * Attaches a callback for only the rejection of the Promise. + * @param onrejected The callback to execute when the Promise is rejected. + * @returns A Promise for the completion of the callback. + */ + catch(onrejected?: (reason: any) => T | PromiseLike): Promise; + catch(onrejected?: (reason: any) => void): Promise; + + [Symbol.toStringTag]: string; +} + +interface PromiseConstructor { + /** + * A reference to the prototype. + */ + prototype: Promise; + + /** + * Creates a new Promise. + * @param executor A callback used to initialize the promise. This callback is passed two arguments: + * a resolve callback used resolve the promise with a value or the result of another promise, + * and a reject callback used to reject the promise with a provided reason or error. + */ + new (executor: (resolve: (value?: T | PromiseLike) => void, reject: (reason?: any) => void) => void): Promise; + + /** + * Creates a Promise that is resolved with an array of results when all of the provided Promises + * resolve, or rejected when any Promise is rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + all(values: Iterable>): Promise; + + /** + * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved + * or rejected. + * @param values An array of Promises. + * @returns A new Promise. + */ + race(values: Iterable>): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new rejected promise for the provided reason. + * @param reason The reason the promise was rejected. + * @returns A new rejected Promise. + */ + reject(reason: any): Promise; + + /** + * Creates a new resolved promise for the provided value. + * @param value A promise. + * @returns A promise whose internal state matches the provided promise. + */ + resolve(value: T | PromiseLike): Promise; + + /** + * Creates a new resolved promise . + * @returns A resolved promise. + */ + resolve(): Promise; + + [Symbol.species]: Function; +} + +declare var Promise: PromiseConstructor; diff --git a/elpa/tide-20220514.614/tsserver/lib.d.ts b/elpa/tide-20220514.614/tsserver/lib.d.ts new file mode 100644 index 0000000..38a1cc0 --- /dev/null +++ b/elpa/tide-20220514.614/tsserver/lib.d.ts @@ -0,0 +1,24 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + + + +/// + + +/// +/// +/// +/// diff --git a/elpa/tide-20220514.614/tsserver/lib.dom.d.ts b/elpa/tide-20220514.614/tsserver/lib.dom.d.ts new file mode 100644 index 0000000..47bb467 --- /dev/null +++ b/elpa/tide-20220514.614/tsserver/lib.dom.d.ts @@ -0,0 +1,17791 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + + + +/// + + +///////////////////////////// +/// Window APIs +///////////////////////////// + +interface AddEventListenerOptions extends EventListenerOptions { + once?: boolean; + passive?: boolean; + signal?: AbortSignal; +} + +interface AesCbcParams extends Algorithm { + iv: BufferSource; +} + +interface AesCtrParams extends Algorithm { + counter: BufferSource; + length: number; +} + +interface AesDerivedKeyParams extends Algorithm { + length: number; +} + +interface AesGcmParams extends Algorithm { + additionalData?: BufferSource; + iv: BufferSource; + tagLength?: number; +} + +interface AesKeyAlgorithm extends KeyAlgorithm { + length: number; +} + +interface AesKeyGenParams extends Algorithm { + length: number; +} + +interface Algorithm { + name: string; +} + +interface AnalyserOptions extends AudioNodeOptions { + fftSize?: number; + maxDecibels?: number; + minDecibels?: number; + smoothingTimeConstant?: number; +} + +interface AnimationEventInit extends EventInit { + animationName?: string; + elapsedTime?: number; + pseudoElement?: string; +} + +interface AnimationPlaybackEventInit extends EventInit { + currentTime?: CSSNumberish | null; + timelineTime?: CSSNumberish | null; +} + +interface AssignedNodesOptions { + flatten?: boolean; +} + +interface AudioBufferOptions { + length: number; + numberOfChannels?: number; + sampleRate: number; +} + +interface AudioBufferSourceOptions { + buffer?: AudioBuffer | null; + detune?: number; + loop?: boolean; + loopEnd?: number; + loopStart?: number; + playbackRate?: number; +} + +interface AudioConfiguration { + bitrate?: number; + channels?: string; + contentType: string; + samplerate?: number; + spatialRendering?: boolean; +} + +interface AudioContextOptions { + latencyHint?: AudioContextLatencyCategory | number; + sampleRate?: number; +} + +interface AudioNodeOptions { + channelCount?: number; + channelCountMode?: ChannelCountMode; + channelInterpretation?: ChannelInterpretation; +} + +interface AudioProcessingEventInit extends EventInit { + inputBuffer: AudioBuffer; + outputBuffer: AudioBuffer; + playbackTime: number; +} + +interface AudioTimestamp { + contextTime?: number; + performanceTime?: DOMHighResTimeStamp; +} + +interface AudioWorkletNodeOptions extends AudioNodeOptions { + numberOfInputs?: number; + numberOfOutputs?: number; + outputChannelCount?: number[]; + parameterData?: Record; + processorOptions?: any; +} + +interface AuthenticationExtensionsClientInputs { + appid?: string; + appidExclude?: string; + credProps?: boolean; + uvm?: boolean; +} + +interface AuthenticationExtensionsClientOutputs { + appid?: boolean; + credProps?: CredentialPropertiesOutput; + uvm?: UvmEntries; +} + +interface AuthenticatorSelectionCriteria { + authenticatorAttachment?: AuthenticatorAttachment; + requireResidentKey?: boolean; + residentKey?: ResidentKeyRequirement; + userVerification?: UserVerificationRequirement; +} + +interface BiquadFilterOptions extends AudioNodeOptions { + Q?: number; + detune?: number; + frequency?: number; + gain?: number; + type?: BiquadFilterType; +} + +interface BlobEventInit { + data: Blob; + timecode?: DOMHighResTimeStamp; +} + +interface BlobPropertyBag { + endings?: EndingType; + type?: string; +} + +interface CSSStyleSheetInit { + baseURL?: string; + disabled?: boolean; + media?: MediaList | string; +} + +interface CacheQueryOptions { + ignoreMethod?: boolean; + ignoreSearch?: boolean; + ignoreVary?: boolean; +} + +interface CanvasRenderingContext2DSettings { + alpha?: boolean; + colorSpace?: PredefinedColorSpace; + desynchronized?: boolean; + willReadFrequently?: boolean; +} + +interface ChannelMergerOptions extends AudioNodeOptions { + numberOfInputs?: number; +} + +interface ChannelSplitterOptions extends AudioNodeOptions { + numberOfOutputs?: number; +} + +interface ClientQueryOptions { + includeUncontrolled?: boolean; + type?: ClientTypes; +} + +interface ClipboardEventInit extends EventInit { + clipboardData?: DataTransfer | null; +} + +interface ClipboardItemOptions { + presentationStyle?: PresentationStyle; +} + +interface CloseEventInit extends EventInit { + code?: number; + reason?: string; + wasClean?: boolean; +} + +interface CompositionEventInit extends UIEventInit { + data?: string; +} + +interface ComputedEffectTiming extends EffectTiming { + activeDuration?: CSSNumberish; + currentIteration?: number | null; + endTime?: CSSNumberish; + localTime?: CSSNumberish | null; + progress?: CSSNumberish | null; + startTime?: CSSNumberish; +} + +interface ComputedKeyframe { + composite: CompositeOperationOrAuto; + computedOffset: number; + easing: string; + offset: number | null; + [property: string]: string | number | null | undefined; +} + +interface ConstantSourceOptions { + offset?: number; +} + +interface ConstrainBooleanParameters { + exact?: boolean; + ideal?: boolean; +} + +interface ConstrainDOMStringParameters { + exact?: string | string[]; + ideal?: string | string[]; +} + +interface ConstrainDoubleRange extends DoubleRange { + exact?: number; + ideal?: number; +} + +interface ConstrainULongRange extends ULongRange { + exact?: number; + ideal?: number; +} + +interface ConvolverOptions extends AudioNodeOptions { + buffer?: AudioBuffer | null; + disableNormalization?: boolean; +} + +interface CredentialCreationOptions { + publicKey?: PublicKeyCredentialCreationOptions; + signal?: AbortSignal; +} + +interface CredentialPropertiesOutput { + rk?: boolean; +} + +interface CredentialRequestOptions { + mediation?: CredentialMediationRequirement; + publicKey?: PublicKeyCredentialRequestOptions; + signal?: AbortSignal; +} + +interface CryptoKeyPair { + privateKey?: CryptoKey; + publicKey?: CryptoKey; +} + +interface CustomEventInit extends EventInit { + detail?: T; +} + +interface DOMMatrix2DInit { + a?: number; + b?: number; + c?: number; + d?: number; + e?: number; + f?: number; + m11?: number; + m12?: number; + m21?: number; + m22?: number; + m41?: number; + m42?: number; +} + +interface DOMMatrixInit extends DOMMatrix2DInit { + is2D?: boolean; + m13?: number; + m14?: number; + m23?: number; + m24?: number; + m31?: number; + m32?: number; + m33?: number; + m34?: number; + m43?: number; + m44?: number; +} + +interface DOMPointInit { + w?: number; + x?: number; + y?: number; + z?: number; +} + +interface DOMQuadInit { + p1?: DOMPointInit; + p2?: DOMPointInit; + p3?: DOMPointInit; + p4?: DOMPointInit; +} + +interface DOMRectInit { + height?: number; + width?: number; + x?: number; + y?: number; +} + +interface DelayOptions extends AudioNodeOptions { + delayTime?: number; + maxDelayTime?: number; +} + +interface DeviceMotionEventAccelerationInit { + x?: number | null; + y?: number | null; + z?: number | null; +} + +interface DeviceMotionEventInit extends EventInit { + acceleration?: DeviceMotionEventAccelerationInit; + accelerationIncludingGravity?: DeviceMotionEventAccelerationInit; + interval?: number; + rotationRate?: DeviceMotionEventRotationRateInit; +} + +interface DeviceMotionEventRotationRateInit { + alpha?: number | null; + beta?: number | null; + gamma?: number | null; +} + +interface DeviceOrientationEventInit extends EventInit { + absolute?: boolean; + alpha?: number | null; + beta?: number | null; + gamma?: number | null; +} + +interface DisplayMediaStreamConstraints { + audio?: boolean | MediaTrackConstraints; + video?: boolean | MediaTrackConstraints; +} + +interface DocumentTimelineOptions { + originTime?: DOMHighResTimeStamp; +} + +interface DoubleRange { + max?: number; + min?: number; +} + +interface DragEventInit extends MouseEventInit { + dataTransfer?: DataTransfer | null; +} + +interface DynamicsCompressorOptions extends AudioNodeOptions { + attack?: number; + knee?: number; + ratio?: number; + release?: number; + threshold?: number; +} + +interface EcKeyAlgorithm extends KeyAlgorithm { + namedCurve: NamedCurve; +} + +interface EcKeyGenParams extends Algorithm { + namedCurve: NamedCurve; +} + +interface EcKeyImportParams extends Algorithm { + namedCurve: NamedCurve; +} + +interface EcdhKeyDeriveParams extends Algorithm { + public: CryptoKey; +} + +interface EcdsaParams extends Algorithm { + hash: HashAlgorithmIdentifier; +} + +interface EffectTiming { + delay?: number; + direction?: PlaybackDirection; + duration?: number | string; + easing?: string; + endDelay?: number; + fill?: FillMode; + iterationStart?: number; + iterations?: number; + playbackRate?: number; +} + +interface ElementCreationOptions { + is?: string; +} + +interface ElementDefinitionOptions { + extends?: string; +} + +interface ErrorEventInit extends EventInit { + colno?: number; + error?: any; + filename?: string; + lineno?: number; + message?: string; +} + +interface EventInit { + bubbles?: boolean; + cancelable?: boolean; + composed?: boolean; +} + +interface EventListenerOptions { + capture?: boolean; +} + +interface EventModifierInit extends UIEventInit { + altKey?: boolean; + ctrlKey?: boolean; + metaKey?: boolean; + modifierAltGraph?: boolean; + modifierCapsLock?: boolean; + modifierFn?: boolean; + modifierFnLock?: boolean; + modifierHyper?: boolean; + modifierNumLock?: boolean; + modifierScrollLock?: boolean; + modifierSuper?: boolean; + modifierSymbol?: boolean; + modifierSymbolLock?: boolean; + shiftKey?: boolean; +} + +interface EventSourceInit { + withCredentials?: boolean; +} + +interface FilePropertyBag extends BlobPropertyBag { + lastModified?: number; +} + +interface FileSystemFlags { + create?: boolean; + exclusive?: boolean; +} + +interface FocusEventInit extends UIEventInit { + relatedTarget?: EventTarget | null; +} + +interface FocusOptions { + preventScroll?: boolean; +} + +interface FontFaceDescriptors { + display?: string; + featureSettings?: string; + stretch?: string; + style?: string; + unicodeRange?: string; + variant?: string; + weight?: string; +} + +interface FontFaceSetLoadEventInit extends EventInit { + fontfaces?: FontFace[]; +} + +interface FormDataEventInit extends EventInit { + formData: FormData; +} + +interface FullscreenOptions { + navigationUI?: FullscreenNavigationUI; +} + +interface GainOptions extends AudioNodeOptions { + gain?: number; +} + +interface GamepadEventInit extends EventInit { + gamepad: Gamepad; +} + +interface GetAnimationsOptions { + subtree?: boolean; +} + +interface GetNotificationOptions { + tag?: string; +} + +interface GetRootNodeOptions { + composed?: boolean; +} + +interface HashChangeEventInit extends EventInit { + newURL?: string; + oldURL?: string; +} + +interface HkdfParams extends Algorithm { + hash: HashAlgorithmIdentifier; + info: BufferSource; + salt: BufferSource; +} + +interface HmacImportParams extends Algorithm { + hash: HashAlgorithmIdentifier; + length?: number; +} + +interface HmacKeyAlgorithm extends KeyAlgorithm { + hash: KeyAlgorithm; + length: number; +} + +interface HmacKeyGenParams extends Algorithm { + hash: HashAlgorithmIdentifier; + length?: number; +} + +interface IDBDatabaseInfo { + name?: string; + version?: number; +} + +interface IDBIndexParameters { + multiEntry?: boolean; + unique?: boolean; +} + +interface IDBObjectStoreParameters { + autoIncrement?: boolean; + keyPath?: string | string[] | null; +} + +interface IDBVersionChangeEventInit extends EventInit { + newVersion?: number | null; + oldVersion?: number; +} + +interface IIRFilterOptions extends AudioNodeOptions { + feedback: number[]; + feedforward: number[]; +} + +interface IdleRequestOptions { + timeout?: number; +} + +interface ImageBitmapOptions { + colorSpaceConversion?: ColorSpaceConversion; + imageOrientation?: ImageOrientation; + premultiplyAlpha?: PremultiplyAlpha; + resizeHeight?: number; + resizeQuality?: ResizeQuality; + resizeWidth?: number; +} + +interface ImageBitmapRenderingContextSettings { + alpha?: boolean; +} + +interface ImageDataSettings { + colorSpace?: PredefinedColorSpace; +} + +interface ImportMeta { + url: string; +} + +interface InputEventInit extends UIEventInit { + data?: string | null; + dataTransfer?: DataTransfer | null; + inputType?: string; + isComposing?: boolean; + targetRanges?: StaticRange[]; +} + +interface IntersectionObserverEntryInit { + boundingClientRect: DOMRectInit; + intersectionRatio: number; + intersectionRect: DOMRectInit; + isIntersecting: boolean; + rootBounds: DOMRectInit | null; + target: Element; + time: DOMHighResTimeStamp; +} + +interface IntersectionObserverInit { + root?: Element | Document | null; + rootMargin?: string; + threshold?: number | number[]; +} + +interface JsonWebKey { + alg?: string; + crv?: string; + d?: string; + dp?: string; + dq?: string; + e?: string; + ext?: boolean; + k?: string; + key_ops?: string[]; + kty?: string; + n?: string; + oth?: RsaOtherPrimesInfo[]; + p?: string; + q?: string; + qi?: string; + use?: string; + x?: string; + y?: string; +} + +interface KeyAlgorithm { + name: string; +} + +interface KeyboardEventInit extends EventModifierInit { + /** @deprecated */ + charCode?: number; + code?: string; + isComposing?: boolean; + key?: string; + /** @deprecated */ + keyCode?: number; + location?: number; + repeat?: boolean; +} + +interface Keyframe { + composite?: CompositeOperationOrAuto; + easing?: string; + offset?: number | null; + [property: string]: string | number | null | undefined; +} + +interface KeyframeAnimationOptions extends KeyframeEffectOptions { + id?: string; +} + +interface KeyframeEffectOptions extends EffectTiming { + composite?: CompositeOperation; + iterationComposite?: IterationCompositeOperation; + pseudoElement?: string | null; +} + +interface MediaCapabilitiesDecodingInfo extends MediaCapabilitiesInfo { + configuration?: MediaDecodingConfiguration; +} + +interface MediaCapabilitiesEncodingInfo extends MediaCapabilitiesInfo { + configuration?: MediaEncodingConfiguration; +} + +interface MediaCapabilitiesInfo { + powerEfficient: boolean; + smooth: boolean; + supported: boolean; +} + +interface MediaConfiguration { + audio?: AudioConfiguration; + video?: VideoConfiguration; +} + +interface MediaDecodingConfiguration extends MediaConfiguration { + type: MediaDecodingType; +} + +interface MediaElementAudioSourceOptions { + mediaElement: HTMLMediaElement; +} + +interface MediaEncodingConfiguration extends MediaConfiguration { + type: MediaEncodingType; +} + +interface MediaEncryptedEventInit extends EventInit { + initData?: ArrayBuffer | null; + initDataType?: string; +} + +interface MediaImage { + sizes?: string; + src: string; + type?: string; +} + +interface MediaKeyMessageEventInit extends EventInit { + message: ArrayBuffer; + messageType: MediaKeyMessageType; +} + +interface MediaKeySystemConfiguration { + audioCapabilities?: MediaKeySystemMediaCapability[]; + distinctiveIdentifier?: MediaKeysRequirement; + initDataTypes?: string[]; + label?: string; + persistentState?: MediaKeysRequirement; + sessionTypes?: string[]; + videoCapabilities?: MediaKeySystemMediaCapability[]; +} + +interface MediaKeySystemMediaCapability { + contentType?: string; + encryptionScheme?: string | null; + robustness?: string; +} + +interface MediaMetadataInit { + album?: string; + artist?: string; + artwork?: MediaImage[]; + title?: string; +} + +interface MediaPositionState { + duration?: number; + playbackRate?: number; + position?: number; +} + +interface MediaQueryListEventInit extends EventInit { + matches?: boolean; + media?: string; +} + +interface MediaRecorderErrorEventInit extends EventInit { + error: DOMException; +} + +interface MediaRecorderOptions { + audioBitsPerSecond?: number; + bitsPerSecond?: number; + mimeType?: string; + videoBitsPerSecond?: number; +} + +interface MediaSessionActionDetails { + action: MediaSessionAction; + fastSeek?: boolean | null; + seekOffset?: number | null; + seekTime?: number | null; +} + +interface MediaStreamAudioSourceOptions { + mediaStream: MediaStream; +} + +interface MediaStreamConstraints { + audio?: boolean | MediaTrackConstraints; + peerIdentity?: string; + preferCurrentTab?: boolean; + video?: boolean | MediaTrackConstraints; +} + +interface MediaStreamTrackEventInit extends EventInit { + track: MediaStreamTrack; +} + +interface MediaTrackCapabilities { + aspectRatio?: DoubleRange; + autoGainControl?: boolean[]; + channelCount?: ULongRange; + cursor?: string[]; + deviceId?: string; + displaySurface?: string; + echoCancellation?: boolean[]; + facingMode?: string[]; + frameRate?: DoubleRange; + groupId?: string; + height?: ULongRange; + latency?: DoubleRange; + logicalSurface?: boolean; + noiseSuppression?: boolean[]; + resizeMode?: string[]; + sampleRate?: ULongRange; + sampleSize?: ULongRange; + width?: ULongRange; +} + +interface MediaTrackConstraintSet { + aspectRatio?: ConstrainDouble; + autoGainControl?: ConstrainBoolean; + channelCount?: ConstrainULong; + deviceId?: ConstrainDOMString; + echoCancellation?: ConstrainBoolean; + facingMode?: ConstrainDOMString; + frameRate?: ConstrainDouble; + groupId?: ConstrainDOMString; + height?: ConstrainULong; + latency?: ConstrainDouble; + noiseSuppression?: ConstrainBoolean; + sampleRate?: ConstrainULong; + sampleSize?: ConstrainULong; + suppressLocalAudioPlayback?: ConstrainBoolean; + width?: ConstrainULong; +} + +interface MediaTrackConstraints extends MediaTrackConstraintSet { + advanced?: MediaTrackConstraintSet[]; +} + +interface MediaTrackSettings { + aspectRatio?: number; + autoGainControl?: boolean; + deviceId?: string; + echoCancellation?: boolean; + facingMode?: string; + frameRate?: number; + groupId?: string; + height?: number; + noiseSuppression?: boolean; + restrictOwnAudio?: boolean; + sampleRate?: number; + sampleSize?: number; + width?: number; +} + +interface MediaTrackSupportedConstraints { + aspectRatio?: boolean; + autoGainControl?: boolean; + deviceId?: boolean; + echoCancellation?: boolean; + facingMode?: boolean; + frameRate?: boolean; + groupId?: boolean; + height?: boolean; + noiseSuppression?: boolean; + sampleRate?: boolean; + sampleSize?: boolean; + suppressLocalAudioPlayback?: boolean; + width?: boolean; +} + +interface MessageEventInit extends EventInit { + data?: T; + lastEventId?: string; + origin?: string; + ports?: MessagePort[]; + source?: MessageEventSource | null; +} + +interface MouseEventInit extends EventModifierInit { + button?: number; + buttons?: number; + clientX?: number; + clientY?: number; + movementX?: number; + movementY?: number; + relatedTarget?: EventTarget | null; + screenX?: number; + screenY?: number; +} + +interface MultiCacheQueryOptions extends CacheQueryOptions { + cacheName?: string; +} + +interface MutationObserverInit { + /** Set to a list of attribute local names (without namespace) if not all attribute mutations need to be observed and attributes is true or omitted. */ + attributeFilter?: string[]; + /** Set to true if attributes is true or omitted and target's attribute value before the mutation needs to be recorded. */ + attributeOldValue?: boolean; + /** Set to true if mutations to target's attributes are to be observed. Can be omitted if attributeOldValue or attributeFilter is specified. */ + attributes?: boolean; + /** Set to true if mutations to target's data are to be observed. Can be omitted if characterDataOldValue is specified. */ + characterData?: boolean; + /** Set to true if characterData is set to true or omitted and target's data before the mutation needs to be recorded. */ + characterDataOldValue?: boolean; + /** Set to true if mutations to target's children are to be observed. */ + childList?: boolean; + /** Set to true if mutations to not just target, but also target's descendants are to be observed. */ + subtree?: boolean; +} + +interface NotificationAction { + action: string; + icon?: string; + title: string; +} + +interface NotificationOptions { + actions?: NotificationAction[]; + badge?: string; + body?: string; + data?: any; + dir?: NotificationDirection; + icon?: string; + image?: string; + lang?: string; + renotify?: boolean; + requireInteraction?: boolean; + silent?: boolean; + tag?: string; + timestamp?: DOMTimeStamp; + vibrate?: VibratePattern; +} + +interface OfflineAudioCompletionEventInit extends EventInit { + renderedBuffer: AudioBuffer; +} + +interface OfflineAudioContextOptions { + length: number; + numberOfChannels?: number; + sampleRate: number; +} + +interface OptionalEffectTiming { + delay?: number; + direction?: PlaybackDirection; + duration?: number | string; + easing?: string; + endDelay?: number; + fill?: FillMode; + iterationStart?: number; + iterations?: number; + playbackRate?: number; +} + +interface OscillatorOptions extends AudioNodeOptions { + detune?: number; + frequency?: number; + periodicWave?: PeriodicWave; + type?: OscillatorType; +} + +interface PageTransitionEventInit extends EventInit { + persisted?: boolean; +} + +interface PannerOptions extends AudioNodeOptions { + coneInnerAngle?: number; + coneOuterAngle?: number; + coneOuterGain?: number; + distanceModel?: DistanceModelType; + maxDistance?: number; + orientationX?: number; + orientationY?: number; + orientationZ?: number; + panningModel?: PanningModelType; + positionX?: number; + positionY?: number; + positionZ?: number; + refDistance?: number; + rolloffFactor?: number; +} + +interface PaymentCurrencyAmount { + currency: string; + value: string; +} + +interface PaymentDetailsBase { + displayItems?: PaymentItem[]; + modifiers?: PaymentDetailsModifier[]; +} + +interface PaymentDetailsInit extends PaymentDetailsBase { + id?: string; + total: PaymentItem; +} + +interface PaymentDetailsModifier { + additionalDisplayItems?: PaymentItem[]; + data?: any; + supportedMethods: string; + total?: PaymentItem; +} + +interface PaymentDetailsUpdate extends PaymentDetailsBase { + paymentMethodErrors?: any; + total?: PaymentItem; +} + +interface PaymentItem { + amount: PaymentCurrencyAmount; + label: string; + pending?: boolean; +} + +interface PaymentMethodChangeEventInit extends PaymentRequestUpdateEventInit { + methodDetails?: any; + methodName?: string; +} + +interface PaymentMethodData { + data?: any; + supportedMethods: string; +} + +interface PaymentRequestUpdateEventInit extends EventInit { +} + +interface PaymentValidationErrors { + error?: string; + paymentMethod?: any; +} + +interface Pbkdf2Params extends Algorithm { + hash: HashAlgorithmIdentifier; + iterations: number; + salt: BufferSource; +} + +interface PerformanceMarkOptions { + detail?: any; + startTime?: DOMHighResTimeStamp; +} + +interface PerformanceMeasureOptions { + detail?: any; + duration?: DOMHighResTimeStamp; + end?: string | DOMHighResTimeStamp; + start?: string | DOMHighResTimeStamp; +} + +interface PerformanceObserverInit { + buffered?: boolean; + entryTypes?: string[]; + type?: string; +} + +interface PeriodicWaveConstraints { + disableNormalization?: boolean; +} + +interface PeriodicWaveOptions extends PeriodicWaveConstraints { + imag?: number[] | Float32Array; + real?: number[] | Float32Array; +} + +interface PermissionDescriptor { + name: PermissionName; +} + +interface PointerEventInit extends MouseEventInit { + coalescedEvents?: PointerEvent[]; + height?: number; + isPrimary?: boolean; + pointerId?: number; + pointerType?: string; + predictedEvents?: PointerEvent[]; + pressure?: number; + tangentialPressure?: number; + tiltX?: number; + tiltY?: number; + twist?: number; + width?: number; +} + +interface PopStateEventInit extends EventInit { + state?: any; +} + +interface PositionOptions { + enableHighAccuracy?: boolean; + maximumAge?: number; + timeout?: number; +} + +interface ProgressEventInit extends EventInit { + lengthComputable?: boolean; + loaded?: number; + total?: number; +} + +interface PromiseRejectionEventInit extends EventInit { + promise: Promise; + reason?: any; +} + +interface PropertyIndexedKeyframes { + composite?: CompositeOperationOrAuto | CompositeOperationOrAuto[]; + easing?: string | string[]; + offset?: number | (number | null)[]; + [property: string]: string | string[] | number | null | (number | null)[] | undefined; +} + +interface PublicKeyCredentialCreationOptions { + attestation?: AttestationConveyancePreference; + authenticatorSelection?: AuthenticatorSelectionCriteria; + challenge: BufferSource; + excludeCredentials?: PublicKeyCredentialDescriptor[]; + extensions?: AuthenticationExtensionsClientInputs; + pubKeyCredParams: PublicKeyCredentialParameters[]; + rp: PublicKeyCredentialRpEntity; + timeout?: number; + user: PublicKeyCredentialUserEntity; +} + +interface PublicKeyCredentialDescriptor { + id: BufferSource; + transports?: AuthenticatorTransport[]; + type: PublicKeyCredentialType; +} + +interface PublicKeyCredentialEntity { + name: string; +} + +interface PublicKeyCredentialParameters { + alg: COSEAlgorithmIdentifier; + type: PublicKeyCredentialType; +} + +interface PublicKeyCredentialRequestOptions { + allowCredentials?: PublicKeyCredentialDescriptor[]; + challenge: BufferSource; + extensions?: AuthenticationExtensionsClientInputs; + rpId?: string; + timeout?: number; + userVerification?: UserVerificationRequirement; +} + +interface PublicKeyCredentialRpEntity extends PublicKeyCredentialEntity { + id?: string; +} + +interface PublicKeyCredentialUserEntity extends PublicKeyCredentialEntity { + displayName: string; + id: BufferSource; +} + +interface PushSubscriptionJSON { + endpoint?: string; + expirationTime?: DOMTimeStamp | null; + keys?: Record; +} + +interface PushSubscriptionOptionsInit { + applicationServerKey?: BufferSource | string | null; + userVisibleOnly?: boolean; +} + +interface QueuingStrategy { + highWaterMark?: number; + size?: QueuingStrategySize; +} + +interface QueuingStrategyInit { + /** + * Creates a new ByteLengthQueuingStrategy with the provided high water mark. + * + * Note that the provided high water mark will not be validated ahead of time. Instead, if it is negative, NaN, or not a number, the resulting ByteLengthQueuingStrategy will cause the corresponding stream constructor to throw. + */ + highWaterMark: number; +} + +interface RTCAnswerOptions extends RTCOfferAnswerOptions { +} + +interface RTCCertificateExpiration { + expires?: DOMTimeStamp; +} + +interface RTCConfiguration { + bundlePolicy?: RTCBundlePolicy; + certificates?: RTCCertificate[]; + iceCandidatePoolSize?: number; + iceServers?: RTCIceServer[]; + iceTransportPolicy?: RTCIceTransportPolicy; + rtcpMuxPolicy?: RTCRtcpMuxPolicy; +} + +interface RTCDTMFToneChangeEventInit extends EventInit { + tone?: string; +} + +interface RTCDataChannelEventInit extends EventInit { + channel: RTCDataChannel; +} + +interface RTCDataChannelInit { + id?: number; + maxPacketLifeTime?: number; + maxRetransmits?: number; + negotiated?: boolean; + ordered?: boolean; + protocol?: string; +} + +interface RTCDtlsFingerprint { + algorithm?: string; + value?: string; +} + +interface RTCIceCandidateInit { + candidate?: string; + sdpMLineIndex?: number | null; + sdpMid?: string | null; + usernameFragment?: string | null; +} + +interface RTCIceCandidatePairStats extends RTCStats { + availableIncomingBitrate?: number; + availableOutgoingBitrate?: number; + bytesReceived?: number; + bytesSent?: number; + currentRoundTripTime?: number; + localCandidateId: string; + nominated?: boolean; + remoteCandidateId: string; + requestsReceived?: number; + requestsSent?: number; + responsesReceived?: number; + responsesSent?: number; + state: RTCStatsIceCandidatePairState; + totalRoundTripTime?: number; + transportId: string; +} + +interface RTCIceServer { + credential?: string; + credentialType?: RTCIceCredentialType; + urls: string | string[]; + username?: string; +} + +interface RTCInboundRtpStreamStats extends RTCReceivedRtpStreamStats { + firCount?: number; + framesDecoded?: number; + nackCount?: number; + pliCount?: number; + qpSum?: number; + remoteId?: string; +} + +interface RTCLocalSessionDescriptionInit { + sdp?: string; + type?: RTCSdpType; +} + +interface RTCOfferAnswerOptions { +} + +interface RTCOfferOptions extends RTCOfferAnswerOptions { + iceRestart?: boolean; + offerToReceiveAudio?: boolean; + offerToReceiveVideo?: boolean; +} + +interface RTCOutboundRtpStreamStats extends RTCSentRtpStreamStats { + firCount?: number; + framesEncoded?: number; + nackCount?: number; + pliCount?: number; + qpSum?: number; + remoteId?: string; +} + +interface RTCPeerConnectionIceErrorEventInit extends EventInit { + address?: string | null; + errorCode: number; + errorText?: string; + port?: number | null; + url?: string; +} + +interface RTCPeerConnectionIceEventInit extends EventInit { + candidate?: RTCIceCandidate | null; + url?: string | null; +} + +interface RTCReceivedRtpStreamStats extends RTCRtpStreamStats { + jitter?: number; + packetsDiscarded?: number; + packetsLost?: number; + packetsReceived?: number; +} + +interface RTCRtcpParameters { + cname?: string; + reducedSize?: boolean; +} + +interface RTCRtpCapabilities { + codecs: RTCRtpCodecCapability[]; + headerExtensions: RTCRtpHeaderExtensionCapability[]; +} + +interface RTCRtpCodecCapability { + channels?: number; + clockRate: number; + mimeType: string; + sdpFmtpLine?: string; +} + +interface RTCRtpCodecParameters { + channels?: number; + clockRate: number; + mimeType: string; + payloadType: number; + sdpFmtpLine?: string; +} + +interface RTCRtpCodingParameters { + rid?: string; +} + +interface RTCRtpContributingSource { + audioLevel?: number; + rtpTimestamp: number; + source: number; + timestamp: DOMHighResTimeStamp; +} + +interface RTCRtpEncodingParameters extends RTCRtpCodingParameters { + active?: boolean; + maxBitrate?: number; + priority?: RTCPriorityType; + scaleResolutionDownBy?: number; +} + +interface RTCRtpHeaderExtensionCapability { + uri?: string; +} + +interface RTCRtpHeaderExtensionParameters { + encrypted?: boolean; + id: number; + uri: string; +} + +interface RTCRtpParameters { + codecs: RTCRtpCodecParameters[]; + headerExtensions: RTCRtpHeaderExtensionParameters[]; + rtcp: RTCRtcpParameters; +} + +interface RTCRtpReceiveParameters extends RTCRtpParameters { +} + +interface RTCRtpSendParameters extends RTCRtpParameters { + degradationPreference?: RTCDegradationPreference; + encodings: RTCRtpEncodingParameters[]; + transactionId: string; +} + +interface RTCRtpStreamStats extends RTCStats { + codecId?: string; + kind: string; + ssrc: number; + transportId?: string; +} + +interface RTCRtpSynchronizationSource extends RTCRtpContributingSource { +} + +interface RTCRtpTransceiverInit { + direction?: RTCRtpTransceiverDirection; + sendEncodings?: RTCRtpEncodingParameters[]; + streams?: MediaStream[]; +} + +interface RTCSentRtpStreamStats extends RTCRtpStreamStats { + bytesSent?: number; + packetsSent?: number; +} + +interface RTCSessionDescriptionInit { + sdp?: string; + type: RTCSdpType; +} + +interface RTCStats { + id: string; + timestamp: DOMHighResTimeStamp; + type: RTCStatsType; +} + +interface RTCTrackEventInit extends EventInit { + receiver: RTCRtpReceiver; + streams?: MediaStream[]; + track: MediaStreamTrack; + transceiver: RTCRtpTransceiver; +} + +interface RTCTransportStats extends RTCStats { + bytesReceived?: number; + bytesSent?: number; + dtlsCipher?: string; + dtlsState: RTCDtlsTransportState; + localCertificateId?: string; + remoteCertificateId?: string; + rtcpTransportStatsId?: string; + selectedCandidatePairId?: string; + srtpCipher?: string; + tlsVersion?: string; +} + +interface ReadableStreamDefaultReadDoneResult { + done: true; + value?: undefined; +} + +interface ReadableStreamDefaultReadValueResult { + done: false; + value: T; +} + +interface ReadableWritablePair { + readable: ReadableStream; + /** + * Provides a convenient, chainable way of piping this readable stream through a transform stream (or any other { writable, readable } pair). It simply pipes the stream into the writable side of the supplied pair, and returns the readable side for further use. + * + * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader. + */ + writable: WritableStream; +} + +interface RegistrationOptions { + scope?: string; + type?: WorkerType; + updateViaCache?: ServiceWorkerUpdateViaCache; +} + +interface RequestInit { + /** A BodyInit object or null to set request's body. */ + body?: BodyInit | null; + /** A string indicating how the request will interact with the browser's cache to set request's cache. */ + cache?: RequestCache; + /** A string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL. Sets request's credentials. */ + credentials?: RequestCredentials; + /** A Headers object, an object literal, or an array of two-item arrays to set request's headers. */ + headers?: HeadersInit; + /** A cryptographic hash of the resource to be fetched by request. Sets request's integrity. */ + integrity?: string; + /** A boolean to set request's keepalive. */ + keepalive?: boolean; + /** A string to set request's method. */ + method?: string; + /** A string to indicate whether the request will use CORS, or will be restricted to same-origin URLs. Sets request's mode. */ + mode?: RequestMode; + /** A string indicating whether request follows redirects, results in an error upon encountering a redirect, or returns the redirect (in an opaque fashion). Sets request's redirect. */ + redirect?: RequestRedirect; + /** A string whose value is a same-origin URL, "about:client", or the empty string, to set request's referrer. */ + referrer?: string; + /** A referrer policy to set request's referrerPolicy. */ + referrerPolicy?: ReferrerPolicy; + /** An AbortSignal to set request's signal. */ + signal?: AbortSignal | null; + /** Can only be null. Used to disassociate request from any Window. */ + window?: null; +} + +interface ResizeObserverOptions { + box?: ResizeObserverBoxOptions; +} + +interface ResponseInit { + headers?: HeadersInit; + status?: number; + statusText?: string; +} + +interface RsaHashedImportParams extends Algorithm { + hash: HashAlgorithmIdentifier; +} + +interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm { + hash: KeyAlgorithm; +} + +interface RsaHashedKeyGenParams extends RsaKeyGenParams { + hash: HashAlgorithmIdentifier; +} + +interface RsaKeyAlgorithm extends KeyAlgorithm { + modulusLength: number; + publicExponent: BigInteger; +} + +interface RsaKeyGenParams extends Algorithm { + modulusLength: number; + publicExponent: BigInteger; +} + +interface RsaOaepParams extends Algorithm { + label?: BufferSource; +} + +interface RsaOtherPrimesInfo { + d?: string; + r?: string; + t?: string; +} + +interface RsaPssParams extends Algorithm { + saltLength: number; +} + +interface SVGBoundingBoxOptions { + clipped?: boolean; + fill?: boolean; + markers?: boolean; + stroke?: boolean; +} + +interface ScrollIntoViewOptions extends ScrollOptions { + block?: ScrollLogicalPosition; + inline?: ScrollLogicalPosition; +} + +interface ScrollOptions { + behavior?: ScrollBehavior; +} + +interface ScrollToOptions extends ScrollOptions { + left?: number; + top?: number; +} + +interface SecurityPolicyViolationEventInit extends EventInit { + blockedURI?: string; + columnNumber?: number; + disposition: SecurityPolicyViolationEventDisposition; + documentURI: string; + effectiveDirective: string; + lineNumber?: number; + originalPolicy: string; + referrer?: string; + sample?: string; + sourceFile?: string; + statusCode: number; + violatedDirective: string; +} + +interface ShadowRootInit { + delegatesFocus?: boolean; + mode: ShadowRootMode; + slotAssignment?: SlotAssignmentMode; +} + +interface ShareData { + files?: File[]; + text?: string; + title?: string; + url?: string; +} + +interface SpeechSynthesisErrorEventInit extends SpeechSynthesisEventInit { + error: SpeechSynthesisErrorCode; +} + +interface SpeechSynthesisEventInit extends EventInit { + charIndex?: number; + charLength?: number; + elapsedTime?: number; + name?: string; + utterance: SpeechSynthesisUtterance; +} + +interface StaticRangeInit { + endContainer: Node; + endOffset: number; + startContainer: Node; + startOffset: number; +} + +interface StereoPannerOptions extends AudioNodeOptions { + pan?: number; +} + +interface StorageEstimate { + quota?: number; + usage?: number; +} + +interface StorageEventInit extends EventInit { + key?: string | null; + newValue?: string | null; + oldValue?: string | null; + storageArea?: Storage | null; + url?: string; +} + +interface StreamPipeOptions { + preventAbort?: boolean; + preventCancel?: boolean; + /** + * Pipes this readable stream to a given writable stream destination. The way in which the piping process behaves under various error conditions can be customized with a number of passed options. It returns a promise that fulfills when the piping process completes successfully, or rejects if any errors were encountered. + * + * Piping a stream will lock it for the duration of the pipe, preventing any other consumer from acquiring a reader. + * + * Errors and closures of the source and destination streams propagate as follows: + * + * An error in this source readable stream will abort destination, unless preventAbort is truthy. The returned promise will be rejected with the source's error, or with any error that occurs during aborting the destination. + * + * An error in destination will cancel this source readable stream, unless preventCancel is truthy. The returned promise will be rejected with the destination's error, or with any error that occurs during canceling the source. + * + * When this source readable stream closes, destination will be closed, unless preventClose is truthy. The returned promise will be fulfilled once this process completes, unless an error is encountered while closing the destination, in which case it will be rejected with that error. + * + * If destination starts out closed or closing, this source readable stream will be canceled, unless preventCancel is true. The returned promise will be rejected with an error indicating piping to a closed stream failed, or with any error that occurs during canceling the source. + * + * The signal option can be set to an AbortSignal to allow aborting an ongoing pipe operation via the corresponding AbortController. In this case, this source readable stream will be canceled, and destination aborted, unless the respective options preventCancel or preventAbort are set. + */ + preventClose?: boolean; + signal?: AbortSignal; +} + +interface StructuredSerializeOptions { + transfer?: any[]; +} + +interface SubmitEventInit extends EventInit { + submitter?: HTMLElement | null; +} + +interface TextDecodeOptions { + stream?: boolean; +} + +interface TextDecoderOptions { + fatal?: boolean; + ignoreBOM?: boolean; +} + +interface TextEncoderEncodeIntoResult { + read?: number; + written?: number; +} + +interface TouchEventInit extends EventModifierInit { + changedTouches?: Touch[]; + targetTouches?: Touch[]; + touches?: Touch[]; +} + +interface TouchInit { + altitudeAngle?: number; + azimuthAngle?: number; + clientX?: number; + clientY?: number; + force?: number; + identifier: number; + pageX?: number; + pageY?: number; + radiusX?: number; + radiusY?: number; + rotationAngle?: number; + screenX?: number; + screenY?: number; + target: EventTarget; + touchType?: TouchType; +} + +interface TrackEventInit extends EventInit { + track?: TextTrack | null; +} + +interface Transformer { + flush?: TransformerFlushCallback; + readableType?: undefined; + start?: TransformerStartCallback; + transform?: TransformerTransformCallback; + writableType?: undefined; +} + +interface TransitionEventInit extends EventInit { + elapsedTime?: number; + propertyName?: string; + pseudoElement?: string; +} + +interface UIEventInit extends EventInit { + detail?: number; + view?: Window | null; + /** @deprecated */ + which?: number; +} + +interface ULongRange { + max?: number; + min?: number; +} + +interface UnderlyingSink { + abort?: UnderlyingSinkAbortCallback; + close?: UnderlyingSinkCloseCallback; + start?: UnderlyingSinkStartCallback; + type?: undefined; + write?: UnderlyingSinkWriteCallback; +} + +interface UnderlyingSource { + cancel?: UnderlyingSourceCancelCallback; + pull?: UnderlyingSourcePullCallback; + start?: UnderlyingSourceStartCallback; + type?: undefined; +} + +interface VideoConfiguration { + bitrate: number; + colorGamut?: ColorGamut; + contentType: string; + framerate: number; + hdrMetadataType?: HdrMetadataType; + height: number; + scalabilityMode?: string; + transferFunction?: TransferFunction; + width: number; +} + +interface WaveShaperOptions extends AudioNodeOptions { + curve?: number[] | Float32Array; + oversample?: OverSampleType; +} + +interface WebGLContextAttributes { + alpha?: boolean; + antialias?: boolean; + depth?: boolean; + desynchronized?: boolean; + failIfMajorPerformanceCaveat?: boolean; + powerPreference?: WebGLPowerPreference; + premultipliedAlpha?: boolean; + preserveDrawingBuffer?: boolean; + stencil?: boolean; +} + +interface WebGLContextEventInit extends EventInit { + statusMessage?: string; +} + +interface WheelEventInit extends MouseEventInit { + deltaMode?: number; + deltaX?: number; + deltaY?: number; + deltaZ?: number; +} + +interface WindowPostMessageOptions extends StructuredSerializeOptions { + targetOrigin?: string; +} + +interface WorkerOptions { + credentials?: RequestCredentials; + name?: string; + type?: WorkerType; +} + +interface WorkletOptions { + credentials?: RequestCredentials; +} + +type NodeFilter = ((node: Node) => number) | { acceptNode(node: Node): number; }; + +declare var NodeFilter: { + readonly FILTER_ACCEPT: number; + readonly FILTER_REJECT: number; + readonly FILTER_SKIP: number; + readonly SHOW_ALL: number; + readonly SHOW_ATTRIBUTE: number; + readonly SHOW_CDATA_SECTION: number; + readonly SHOW_COMMENT: number; + readonly SHOW_DOCUMENT: number; + readonly SHOW_DOCUMENT_FRAGMENT: number; + readonly SHOW_DOCUMENT_TYPE: number; + readonly SHOW_ELEMENT: number; + readonly SHOW_ENTITY: number; + readonly SHOW_ENTITY_REFERENCE: number; + readonly SHOW_NOTATION: number; + readonly SHOW_PROCESSING_INSTRUCTION: number; + readonly SHOW_TEXT: number; +}; + +type XPathNSResolver = ((prefix: string | null) => string | null) | { lookupNamespaceURI(prefix: string | null): string | null; }; + +/** The ANGLE_instanced_arrays extension is part of the WebGL API and allows to draw the same object, or groups of similar objects multiple times, if they share the same vertex data, primitive count and type. */ +interface ANGLE_instanced_arrays { + drawArraysInstancedANGLE(mode: GLenum, first: GLint, count: GLsizei, primcount: GLsizei): void; + drawElementsInstancedANGLE(mode: GLenum, count: GLsizei, type: GLenum, offset: GLintptr, primcount: GLsizei): void; + vertexAttribDivisorANGLE(index: GLuint, divisor: GLuint): void; + readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: GLenum; +} + +interface ARIAMixin { + ariaAtomic: string; + ariaAutoComplete: string; + ariaBusy: string; + ariaChecked: string; + ariaColCount: string; + ariaColIndex: string; + ariaColSpan: string; + ariaCurrent: string; + ariaDisabled: string; + ariaExpanded: string; + ariaHasPopup: string; + ariaHidden: string; + ariaKeyShortcuts: string; + ariaLabel: string; + ariaLevel: string; + ariaLive: string; + ariaModal: string; + ariaMultiLine: string; + ariaMultiSelectable: string; + ariaOrientation: string; + ariaPlaceholder: string; + ariaPosInSet: string; + ariaPressed: string; + ariaReadOnly: string; + ariaRequired: string; + ariaRoleDescription: string; + ariaRowCount: string; + ariaRowIndex: string; + ariaRowSpan: string; + ariaSelected: string; + ariaSetSize: string; + ariaSort: string; + ariaValueMax: string; + ariaValueMin: string; + ariaValueNow: string; + ariaValueText: string; +} + +/** A controller object that allows you to abort one or more DOM requests as and when desired. */ +interface AbortController { + /** Returns the AbortSignal object associated with this object. */ + readonly signal: AbortSignal; + /** Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted. */ + abort(): void; +} + +declare var AbortController: { + prototype: AbortController; + new(): AbortController; +}; + +interface AbortSignalEventMap { + "abort": Event; +} + +/** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */ +interface AbortSignal extends EventTarget { + /** Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. */ + readonly aborted: boolean; + onabort: ((this: AbortSignal, ev: Event) => any) | null; + addEventListener(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: AbortSignal, ev: AbortSignalEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var AbortSignal: { + prototype: AbortSignal; + new(): AbortSignal; + // abort(): AbortSignal; - To be re-added in the future +}; + +interface AbstractRange { + /** Returns true if range is collapsed, and false otherwise. */ + readonly collapsed: boolean; + /** Returns range's end node. */ + readonly endContainer: Node; + /** Returns range's end offset. */ + readonly endOffset: number; + /** Returns range's start node. */ + readonly startContainer: Node; + /** Returns range's start offset. */ + readonly startOffset: number; +} + +declare var AbstractRange: { + prototype: AbstractRange; + new(): AbstractRange; +}; + +interface AbstractWorkerEventMap { + "error": ErrorEvent; +} + +interface AbstractWorker { + onerror: ((this: AbstractWorker, ev: ErrorEvent) => any) | null; + addEventListener(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: AbstractWorker, ev: AbstractWorkerEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +/** A node able to provide real-time frequency and time-domain analysis information. It is an AudioNode that passes the audio stream unchanged from the input to the output, but allows you to take the generated data, process it, and create audio visualizations. */ +interface AnalyserNode extends AudioNode { + fftSize: number; + readonly frequencyBinCount: number; + maxDecibels: number; + minDecibels: number; + smoothingTimeConstant: number; + getByteFrequencyData(array: Uint8Array): void; + getByteTimeDomainData(array: Uint8Array): void; + getFloatFrequencyData(array: Float32Array): void; + getFloatTimeDomainData(array: Float32Array): void; +} + +declare var AnalyserNode: { + prototype: AnalyserNode; + new(context: BaseAudioContext, options?: AnalyserOptions): AnalyserNode; +}; + +interface Animatable { + animate(keyframes: Keyframe[] | PropertyIndexedKeyframes | null, options?: number | KeyframeAnimationOptions): Animation; + getAnimations(options?: GetAnimationsOptions): Animation[]; +} + +interface AnimationEventMap { + "cancel": AnimationPlaybackEvent; + "finish": AnimationPlaybackEvent; + "remove": Event; +} + +interface Animation extends EventTarget { + currentTime: CSSNumberish | null; + effect: AnimationEffect | null; + readonly finished: Promise; + id: string; + oncancel: ((this: Animation, ev: AnimationPlaybackEvent) => any) | null; + onfinish: ((this: Animation, ev: AnimationPlaybackEvent) => any) | null; + onremove: ((this: Animation, ev: Event) => any) | null; + readonly pending: boolean; + readonly playState: AnimationPlayState; + playbackRate: number; + readonly ready: Promise; + readonly replaceState: AnimationReplaceState; + startTime: CSSNumberish | null; + timeline: AnimationTimeline | null; + cancel(): void; + commitStyles(): void; + finish(): void; + pause(): void; + persist(): void; + play(): void; + reverse(): void; + updatePlaybackRate(playbackRate: number): void; + addEventListener(type: K, listener: (this: Animation, ev: AnimationEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: Animation, ev: AnimationEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var Animation: { + prototype: Animation; + new(effect?: AnimationEffect | null, timeline?: AnimationTimeline | null): Animation; +}; + +interface AnimationEffect { + getComputedTiming(): ComputedEffectTiming; + getTiming(): EffectTiming; + updateTiming(timing?: OptionalEffectTiming): void; +} + +declare var AnimationEffect: { + prototype: AnimationEffect; + new(): AnimationEffect; +}; + +/** Events providing information related to animations. */ +interface AnimationEvent extends Event { + readonly animationName: string; + readonly elapsedTime: number; + readonly pseudoElement: string; +} + +declare var AnimationEvent: { + prototype: AnimationEvent; + new(type: string, animationEventInitDict?: AnimationEventInit): AnimationEvent; +}; + +interface AnimationFrameProvider { + cancelAnimationFrame(handle: number): void; + requestAnimationFrame(callback: FrameRequestCallback): number; +} + +interface AnimationPlaybackEvent extends Event { + readonly currentTime: CSSNumberish | null; + readonly timelineTime: CSSNumberish | null; +} + +declare var AnimationPlaybackEvent: { + prototype: AnimationPlaybackEvent; + new(type: string, eventInitDict?: AnimationPlaybackEventInit): AnimationPlaybackEvent; +}; + +interface AnimationTimeline { + readonly currentTime: number | null; +} + +declare var AnimationTimeline: { + prototype: AnimationTimeline; + new(): AnimationTimeline; +}; + +/** A DOM element's attribute as an object. In most DOM methods, you will probably directly retrieve the attribute as a string (e.g., Element.getAttribute(), but certain functions (e.g., Element.getAttributeNode()) or means of iterating give Attr types. */ +interface Attr extends Node { + readonly localName: string; + readonly name: string; + readonly namespaceURI: string | null; + readonly ownerDocument: Document; + readonly ownerElement: Element | null; + readonly prefix: string | null; + readonly specified: boolean; + value: string; +} + +declare var Attr: { + prototype: Attr; + new(): Attr; +}; + +/** A short audio asset residing in memory, created from an audio file using the AudioContext.decodeAudioData() method, or from raw data using AudioContext.createBuffer(). Once put into an AudioBuffer, the audio can then be played by being passed into an AudioBufferSourceNode. */ +interface AudioBuffer { + readonly duration: number; + readonly length: number; + readonly numberOfChannels: number; + readonly sampleRate: number; + copyFromChannel(destination: Float32Array, channelNumber: number, bufferOffset?: number): void; + copyToChannel(source: Float32Array, channelNumber: number, bufferOffset?: number): void; + getChannelData(channel: number): Float32Array; +} + +declare var AudioBuffer: { + prototype: AudioBuffer; + new(options: AudioBufferOptions): AudioBuffer; +}; + +/** An AudioScheduledSourceNode which represents an audio source consisting of in-memory audio data, stored in an AudioBuffer. It's especially useful for playing back audio which has particularly stringent timing accuracy requirements, such as for sounds that must match a specific rhythm and can be kept in memory rather than being played from disk or the network. */ +interface AudioBufferSourceNode extends AudioScheduledSourceNode { + buffer: AudioBuffer | null; + readonly detune: AudioParam; + loop: boolean; + loopEnd: number; + loopStart: number; + readonly playbackRate: AudioParam; + start(when?: number, offset?: number, duration?: number): void; + addEventListener(type: K, listener: (this: AudioBufferSourceNode, ev: AudioScheduledSourceNodeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: AudioBufferSourceNode, ev: AudioScheduledSourceNodeEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var AudioBufferSourceNode: { + prototype: AudioBufferSourceNode; + new(context: BaseAudioContext, options?: AudioBufferSourceOptions): AudioBufferSourceNode; +}; + +/** An audio-processing graph built from audio modules linked together, each represented by an AudioNode. */ +interface AudioContext extends BaseAudioContext { + readonly baseLatency: number; + close(): Promise; + createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode; + createMediaStreamDestination(): MediaStreamAudioDestinationNode; + createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode; + getOutputTimestamp(): AudioTimestamp; + resume(): Promise; + suspend(): Promise; + addEventListener(type: K, listener: (this: AudioContext, ev: BaseAudioContextEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: AudioContext, ev: BaseAudioContextEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var AudioContext: { + prototype: AudioContext; + new(contextOptions?: AudioContextOptions): AudioContext; +}; + +/** AudioDestinationNode has no output (as it is the output, no more AudioNode can be linked after it in the audio graph) and one input. The number of channels in the input must be between 0 and the maxChannelCount value or an exception is raised. */ +interface AudioDestinationNode extends AudioNode { + readonly maxChannelCount: number; +} + +declare var AudioDestinationNode: { + prototype: AudioDestinationNode; + new(): AudioDestinationNode; +}; + +/** The position and orientation of the unique person listening to the audio scene, and is used in audio spatialization. All PannerNodes spatialize in relation to the AudioListener stored in the BaseAudioContext.listener attribute. */ +interface AudioListener { + readonly forwardX: AudioParam; + readonly forwardY: AudioParam; + readonly forwardZ: AudioParam; + readonly positionX: AudioParam; + readonly positionY: AudioParam; + readonly positionZ: AudioParam; + readonly upX: AudioParam; + readonly upY: AudioParam; + readonly upZ: AudioParam; + /** @deprecated */ + setOrientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): void; + /** @deprecated */ + setPosition(x: number, y: number, z: number): void; +} + +declare var AudioListener: { + prototype: AudioListener; + new(): AudioListener; +}; + +/** A generic interface for representing an audio processing module. Examples include: */ +interface AudioNode extends EventTarget { + channelCount: number; + channelCountMode: ChannelCountMode; + channelInterpretation: ChannelInterpretation; + readonly context: BaseAudioContext; + readonly numberOfInputs: number; + readonly numberOfOutputs: number; + connect(destinationNode: AudioNode, output?: number, input?: number): AudioNode; + connect(destinationParam: AudioParam, output?: number): void; + disconnect(): void; + disconnect(output: number): void; + disconnect(destinationNode: AudioNode): void; + disconnect(destinationNode: AudioNode, output: number): void; + disconnect(destinationNode: AudioNode, output: number, input: number): void; + disconnect(destinationParam: AudioParam): void; + disconnect(destinationParam: AudioParam, output: number): void; +} + +declare var AudioNode: { + prototype: AudioNode; + new(): AudioNode; +}; + +/** The Web Audio API's AudioParam interface represents an audio-related parameter, usually a parameter of an AudioNode (such as GainNode.gain). */ +interface AudioParam { + automationRate: AutomationRate; + readonly defaultValue: number; + readonly maxValue: number; + readonly minValue: number; + value: number; + cancelAndHoldAtTime(cancelTime: number): AudioParam; + cancelScheduledValues(cancelTime: number): AudioParam; + exponentialRampToValueAtTime(value: number, endTime: number): AudioParam; + linearRampToValueAtTime(value: number, endTime: number): AudioParam; + setTargetAtTime(target: number, startTime: number, timeConstant: number): AudioParam; + setValueAtTime(value: number, startTime: number): AudioParam; + setValueCurveAtTime(values: number[] | Float32Array, startTime: number, duration: number): AudioParam; +} + +declare var AudioParam: { + prototype: AudioParam; + new(): AudioParam; +}; + +interface AudioParamMap { + forEach(callbackfn: (value: AudioParam, key: string, parent: AudioParamMap) => void, thisArg?: any): void; +} + +declare var AudioParamMap: { + prototype: AudioParamMap; + new(): AudioParamMap; +}; + +/** + * The Web Audio API events that occur when a ScriptProcessorNode input buffer is ready to be processed. + * @deprecated As of the August 29 2014 Web Audio API spec publication, this feature has been marked as deprecated, and is soon to be replaced by AudioWorklet. + */ +interface AudioProcessingEvent extends Event { + /** @deprecated */ + readonly inputBuffer: AudioBuffer; + /** @deprecated */ + readonly outputBuffer: AudioBuffer; + /** @deprecated */ + readonly playbackTime: number; +} + +/** @deprecated */ +declare var AudioProcessingEvent: { + prototype: AudioProcessingEvent; + new(type: string, eventInitDict: AudioProcessingEventInit): AudioProcessingEvent; +}; + +interface AudioScheduledSourceNodeEventMap { + "ended": Event; +} + +interface AudioScheduledSourceNode extends AudioNode { + onended: ((this: AudioScheduledSourceNode, ev: Event) => any) | null; + start(when?: number): void; + stop(when?: number): void; + addEventListener(type: K, listener: (this: AudioScheduledSourceNode, ev: AudioScheduledSourceNodeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: AudioScheduledSourceNode, ev: AudioScheduledSourceNodeEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var AudioScheduledSourceNode: { + prototype: AudioScheduledSourceNode; + new(): AudioScheduledSourceNode; +}; + +/** Available only in secure contexts. */ +interface AudioWorklet extends Worklet { +} + +declare var AudioWorklet: { + prototype: AudioWorklet; + new(): AudioWorklet; +}; + +interface AudioWorkletNodeEventMap { + "processorerror": Event; +} + +/** Available only in secure contexts. */ +interface AudioWorkletNode extends AudioNode { + onprocessorerror: ((this: AudioWorkletNode, ev: Event) => any) | null; + readonly parameters: AudioParamMap; + readonly port: MessagePort; + addEventListener(type: K, listener: (this: AudioWorkletNode, ev: AudioWorkletNodeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: AudioWorkletNode, ev: AudioWorkletNodeEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var AudioWorkletNode: { + prototype: AudioWorkletNode; + new(context: BaseAudioContext, name: string, options?: AudioWorkletNodeOptions): AudioWorkletNode; +}; + +/** Available only in secure contexts. */ +interface AuthenticatorAssertionResponse extends AuthenticatorResponse { + readonly authenticatorData: ArrayBuffer; + readonly signature: ArrayBuffer; + readonly userHandle: ArrayBuffer | null; +} + +declare var AuthenticatorAssertionResponse: { + prototype: AuthenticatorAssertionResponse; + new(): AuthenticatorAssertionResponse; +}; + +/** Available only in secure contexts. */ +interface AuthenticatorAttestationResponse extends AuthenticatorResponse { + readonly attestationObject: ArrayBuffer; +} + +declare var AuthenticatorAttestationResponse: { + prototype: AuthenticatorAttestationResponse; + new(): AuthenticatorAttestationResponse; +}; + +/** Available only in secure contexts. */ +interface AuthenticatorResponse { + readonly clientDataJSON: ArrayBuffer; +} + +declare var AuthenticatorResponse: { + prototype: AuthenticatorResponse; + new(): AuthenticatorResponse; +}; + +interface BarProp { + readonly visible: boolean; +} + +declare var BarProp: { + prototype: BarProp; + new(): BarProp; +}; + +interface BaseAudioContextEventMap { + "statechange": Event; +} + +interface BaseAudioContext extends EventTarget { + /** Available only in secure contexts. */ + readonly audioWorklet: AudioWorklet; + readonly currentTime: number; + readonly destination: AudioDestinationNode; + readonly listener: AudioListener; + onstatechange: ((this: BaseAudioContext, ev: Event) => any) | null; + readonly sampleRate: number; + readonly state: AudioContextState; + createAnalyser(): AnalyserNode; + createBiquadFilter(): BiquadFilterNode; + createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer; + createBufferSource(): AudioBufferSourceNode; + createChannelMerger(numberOfInputs?: number): ChannelMergerNode; + createChannelSplitter(numberOfOutputs?: number): ChannelSplitterNode; + createConstantSource(): ConstantSourceNode; + createConvolver(): ConvolverNode; + createDelay(maxDelayTime?: number): DelayNode; + createDynamicsCompressor(): DynamicsCompressorNode; + createGain(): GainNode; + createIIRFilter(feedforward: number[], feedback: number[]): IIRFilterNode; + createOscillator(): OscillatorNode; + createPanner(): PannerNode; + createPeriodicWave(real: number[] | Float32Array, imag: number[] | Float32Array, constraints?: PeriodicWaveConstraints): PeriodicWave; + /** @deprecated */ + createScriptProcessor(bufferSize?: number, numberOfInputChannels?: number, numberOfOutputChannels?: number): ScriptProcessorNode; + createStereoPanner(): StereoPannerNode; + createWaveShaper(): WaveShaperNode; + decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback | null, errorCallback?: DecodeErrorCallback | null): Promise; + addEventListener(type: K, listener: (this: BaseAudioContext, ev: BaseAudioContextEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: BaseAudioContext, ev: BaseAudioContextEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var BaseAudioContext: { + prototype: BaseAudioContext; + new(): BaseAudioContext; +}; + +/** The beforeunload event is fired when the window, the document and its resources are about to be unloaded. */ +interface BeforeUnloadEvent extends Event { + returnValue: any; +} + +declare var BeforeUnloadEvent: { + prototype: BeforeUnloadEvent; + new(): BeforeUnloadEvent; +}; + +/** A simple low-order filter, and is created using the AudioContext.createBiquadFilter() method. It is an AudioNode that can represent different kinds of filters, tone control devices, and graphic equalizers. */ +interface BiquadFilterNode extends AudioNode { + readonly Q: AudioParam; + readonly detune: AudioParam; + readonly frequency: AudioParam; + readonly gain: AudioParam; + type: BiquadFilterType; + getFrequencyResponse(frequencyHz: Float32Array, magResponse: Float32Array, phaseResponse: Float32Array): void; +} + +declare var BiquadFilterNode: { + prototype: BiquadFilterNode; + new(context: BaseAudioContext, options?: BiquadFilterOptions): BiquadFilterNode; +}; + +/** A file-like object of immutable, raw data. Blobs represent data that isn't necessarily in a JavaScript-native format. The File interface is based on Blob, inheriting blob functionality and expanding it to support files on the user's system. */ +interface Blob { + readonly size: number; + readonly type: string; + arrayBuffer(): Promise; + slice(start?: number, end?: number, contentType?: string): Blob; + stream(): ReadableStream; + text(): Promise; +} + +declare var Blob: { + prototype: Blob; + new(blobParts?: BlobPart[], options?: BlobPropertyBag): Blob; +}; + +interface BlobEvent extends Event { + readonly data: Blob; + readonly timecode: DOMHighResTimeStamp; +} + +declare var BlobEvent: { + prototype: BlobEvent; + new(type: string, eventInitDict: BlobEventInit): BlobEvent; +}; + +interface Body { + readonly body: ReadableStream | null; + readonly bodyUsed: boolean; + arrayBuffer(): Promise; + blob(): Promise; + formData(): Promise; + json(): Promise; + text(): Promise; +} + +interface BroadcastChannelEventMap { + "message": MessageEvent; + "messageerror": MessageEvent; +} + +interface BroadcastChannel extends EventTarget { + /** Returns the channel name (as passed to the constructor). */ + readonly name: string; + onmessage: ((this: BroadcastChannel, ev: MessageEvent) => any) | null; + onmessageerror: ((this: BroadcastChannel, ev: MessageEvent) => any) | null; + /** Closes the BroadcastChannel object, opening it up to garbage collection. */ + close(): void; + /** Sends the given message to other BroadcastChannel objects set up for this channel. Messages can be structured objects, e.g. nested objects and arrays. */ + postMessage(message: any): void; + addEventListener(type: K, listener: (this: BroadcastChannel, ev: BroadcastChannelEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: BroadcastChannel, ev: BroadcastChannelEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var BroadcastChannel: { + prototype: BroadcastChannel; + new(name: string): BroadcastChannel; +}; + +/** This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. */ +interface ByteLengthQueuingStrategy extends QueuingStrategy { + readonly highWaterMark: number; + readonly size: QueuingStrategySize; +} + +declare var ByteLengthQueuingStrategy: { + prototype: ByteLengthQueuingStrategy; + new(init: QueuingStrategyInit): ByteLengthQueuingStrategy; +}; + +/** A CDATA section that can be used within XML to include extended portions of unescaped text. The symbols < and & don’t need escaping as they normally do when inside a CDATA section. */ +interface CDATASection extends Text { +} + +declare var CDATASection: { + prototype: CDATASection; + new(): CDATASection; +}; + +interface CSSAnimation extends Animation { + readonly animationName: string; + addEventListener(type: K, listener: (this: CSSAnimation, ev: AnimationEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: CSSAnimation, ev: AnimationEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var CSSAnimation: { + prototype: CSSAnimation; + new(): CSSAnimation; +}; + +/** A single condition CSS at-rule, which consists of a condition and a statement block. It is a child of CSSGroupingRule. */ +interface CSSConditionRule extends CSSGroupingRule { + conditionText: string; +} + +declare var CSSConditionRule: { + prototype: CSSConditionRule; + new(): CSSConditionRule; +}; + +interface CSSCounterStyleRule extends CSSRule { + additiveSymbols: string; + fallback: string; + name: string; + negative: string; + pad: string; + prefix: string; + range: string; + speakAs: string; + suffix: string; + symbols: string; + system: string; +} + +declare var CSSCounterStyleRule: { + prototype: CSSCounterStyleRule; + new(): CSSCounterStyleRule; +}; + +interface CSSFontFaceRule extends CSSRule { + readonly style: CSSStyleDeclaration; +} + +declare var CSSFontFaceRule: { + prototype: CSSFontFaceRule; + new(): CSSFontFaceRule; +}; + +/** Any CSS at-rule that contains other rules nested within it. */ +interface CSSGroupingRule extends CSSRule { + readonly cssRules: CSSRuleList; + deleteRule(index: number): void; + insertRule(rule: string, index?: number): number; +} + +declare var CSSGroupingRule: { + prototype: CSSGroupingRule; + new(): CSSGroupingRule; +}; + +interface CSSImportRule extends CSSRule { + readonly href: string; + readonly media: MediaList; + readonly styleSheet: CSSStyleSheet; +} + +declare var CSSImportRule: { + prototype: CSSImportRule; + new(): CSSImportRule; +}; + +/** An object representing a set of style for a given keyframe. It corresponds to the contains of a single keyframe of a @keyframes at-rule. It implements the CSSRule interface with a type value of 8 (CSSRule.KEYFRAME_RULE). */ +interface CSSKeyframeRule extends CSSRule { + keyText: string; + readonly style: CSSStyleDeclaration; +} + +declare var CSSKeyframeRule: { + prototype: CSSKeyframeRule; + new(): CSSKeyframeRule; +}; + +/** An object representing a complete set of keyframes for a CSS animation. It corresponds to the contains of a whole @keyframes at-rule. It implements the CSSRule interface with a type value of 7 (CSSRule.KEYFRAMES_RULE). */ +interface CSSKeyframesRule extends CSSRule { + readonly cssRules: CSSRuleList; + name: string; + appendRule(rule: string): void; + deleteRule(select: string): void; + findRule(select: string): CSSKeyframeRule | null; +} + +declare var CSSKeyframesRule: { + prototype: CSSKeyframesRule; + new(): CSSKeyframesRule; +}; + +/** A single CSS @media rule. It implements the CSSConditionRule interface, and therefore the CSSGroupingRule and the CSSRule interface with a type value of 4 (CSSRule.MEDIA_RULE). */ +interface CSSMediaRule extends CSSConditionRule { + readonly media: MediaList; +} + +declare var CSSMediaRule: { + prototype: CSSMediaRule; + new(): CSSMediaRule; +}; + +/** An object representing a single CSS @namespace at-rule. It implements the CSSRule interface, with a type value of 10 (CSSRule.NAMESPACE_RULE). */ +interface CSSNamespaceRule extends CSSRule { + readonly namespaceURI: string; + readonly prefix: string; +} + +declare var CSSNamespaceRule: { + prototype: CSSNamespaceRule; + new(): CSSNamespaceRule; +}; + +/** CSSPageRule is an interface representing a single CSS @page rule. It implements the CSSRule interface with a type value of 6 (CSSRule.PAGE_RULE). */ +interface CSSPageRule extends CSSGroupingRule { + selectorText: string; + readonly style: CSSStyleDeclaration; +} + +declare var CSSPageRule: { + prototype: CSSPageRule; + new(): CSSPageRule; +}; + +/** A single CSS rule. There are several types of rules, listed in the Type constants section below. */ +interface CSSRule { + cssText: string; + readonly parentRule: CSSRule | null; + readonly parentStyleSheet: CSSStyleSheet | null; + /** @deprecated */ + readonly type: number; + readonly CHARSET_RULE: number; + readonly FONT_FACE_RULE: number; + readonly IMPORT_RULE: number; + readonly KEYFRAMES_RULE: number; + readonly KEYFRAME_RULE: number; + readonly MEDIA_RULE: number; + readonly NAMESPACE_RULE: number; + readonly PAGE_RULE: number; + readonly STYLE_RULE: number; + readonly SUPPORTS_RULE: number; +} + +declare var CSSRule: { + prototype: CSSRule; + new(): CSSRule; + readonly CHARSET_RULE: number; + readonly FONT_FACE_RULE: number; + readonly IMPORT_RULE: number; + readonly KEYFRAMES_RULE: number; + readonly KEYFRAME_RULE: number; + readonly MEDIA_RULE: number; + readonly NAMESPACE_RULE: number; + readonly PAGE_RULE: number; + readonly STYLE_RULE: number; + readonly SUPPORTS_RULE: number; +}; + +/** A CSSRuleList is an (indirect-modify only) array-like object containing an ordered collection of CSSRule objects. */ +interface CSSRuleList { + readonly length: number; + item(index: number): CSSRule | null; + [index: number]: CSSRule; +} + +declare var CSSRuleList: { + prototype: CSSRuleList; + new(): CSSRuleList; +}; + +/** An object that is a CSS declaration block, and exposes style information and various style-related methods and properties. */ +interface CSSStyleDeclaration { + accentColor: string; + alignContent: string; + alignItems: string; + alignSelf: string; + alignmentBaseline: string; + all: string; + animation: string; + animationDelay: string; + animationDirection: string; + animationDuration: string; + animationFillMode: string; + animationIterationCount: string; + animationName: string; + animationPlayState: string; + animationTimingFunction: string; + appearance: string; + aspectRatio: string; + backfaceVisibility: string; + background: string; + backgroundAttachment: string; + backgroundBlendMode: string; + backgroundClip: string; + backgroundColor: string; + backgroundImage: string; + backgroundOrigin: string; + backgroundPosition: string; + backgroundPositionX: string; + backgroundPositionY: string; + backgroundRepeat: string; + backgroundSize: string; + baselineShift: string; + blockSize: string; + border: string; + borderBlock: string; + borderBlockColor: string; + borderBlockEnd: string; + borderBlockEndColor: string; + borderBlockEndStyle: string; + borderBlockEndWidth: string; + borderBlockStart: string; + borderBlockStartColor: string; + borderBlockStartStyle: string; + borderBlockStartWidth: string; + borderBlockStyle: string; + borderBlockWidth: string; + borderBottom: string; + borderBottomColor: string; + borderBottomLeftRadius: string; + borderBottomRightRadius: string; + borderBottomStyle: string; + borderBottomWidth: string; + borderCollapse: string; + borderColor: string; + borderEndEndRadius: string; + borderEndStartRadius: string; + borderImage: string; + borderImageOutset: string; + borderImageRepeat: string; + borderImageSlice: string; + borderImageSource: string; + borderImageWidth: string; + borderInline: string; + borderInlineColor: string; + borderInlineEnd: string; + borderInlineEndColor: string; + borderInlineEndStyle: string; + borderInlineEndWidth: string; + borderInlineStart: string; + borderInlineStartColor: string; + borderInlineStartStyle: string; + borderInlineStartWidth: string; + borderInlineStyle: string; + borderInlineWidth: string; + borderLeft: string; + borderLeftColor: string; + borderLeftStyle: string; + borderLeftWidth: string; + borderRadius: string; + borderRight: string; + borderRightColor: string; + borderRightStyle: string; + borderRightWidth: string; + borderSpacing: string; + borderStartEndRadius: string; + borderStartStartRadius: string; + borderStyle: string; + borderTop: string; + borderTopColor: string; + borderTopLeftRadius: string; + borderTopRightRadius: string; + borderTopStyle: string; + borderTopWidth: string; + borderWidth: string; + bottom: string; + boxShadow: string; + boxSizing: string; + breakAfter: string; + breakBefore: string; + breakInside: string; + captionSide: string; + caretColor: string; + clear: string; + /** @deprecated */ + clip: string; + clipPath: string; + clipRule: string; + color: string; + colorInterpolation: string; + colorInterpolationFilters: string; + colorScheme: string; + columnCount: string; + columnFill: string; + columnGap: string; + columnRule: string; + columnRuleColor: string; + columnRuleStyle: string; + columnRuleWidth: string; + columnSpan: string; + columnWidth: string; + columns: string; + contain: string; + content: string; + counterIncrement: string; + counterReset: string; + counterSet: string; + cssFloat: string; + cssText: string; + cursor: string; + direction: string; + display: string; + dominantBaseline: string; + emptyCells: string; + fill: string; + fillOpacity: string; + fillRule: string; + filter: string; + flex: string; + flexBasis: string; + flexDirection: string; + flexFlow: string; + flexGrow: string; + flexShrink: string; + flexWrap: string; + float: string; + floodColor: string; + floodOpacity: string; + font: string; + fontFamily: string; + fontFeatureSettings: string; + fontKerning: string; + fontOpticalSizing: string; + fontSize: string; + fontSizeAdjust: string; + fontStretch: string; + fontStyle: string; + fontSynthesis: string; + fontVariant: string; + /** @deprecated */ + fontVariantAlternates: string; + fontVariantCaps: string; + fontVariantEastAsian: string; + fontVariantLigatures: string; + fontVariantNumeric: string; + fontVariantPosition: string; + fontVariationSettings: string; + fontWeight: string; + gap: string; + grid: string; + gridArea: string; + gridAutoColumns: string; + gridAutoFlow: string; + gridAutoRows: string; + gridColumn: string; + gridColumnEnd: string; + /** @deprecated This is a legacy alias of `columnGap`. */ + gridColumnGap: string; + gridColumnStart: string; + /** @deprecated This is a legacy alias of `gap`. */ + gridGap: string; + gridRow: string; + gridRowEnd: string; + /** @deprecated This is a legacy alias of `rowGap`. */ + gridRowGap: string; + gridRowStart: string; + gridTemplate: string; + gridTemplateAreas: string; + gridTemplateColumns: string; + gridTemplateRows: string; + height: string; + hyphens: string; + /** @deprecated */ + imageOrientation: string; + imageRendering: string; + inlineSize: string; + inset: string; + insetBlock: string; + insetBlockEnd: string; + insetBlockStart: string; + insetInline: string; + insetInlineEnd: string; + insetInlineStart: string; + isolation: string; + justifyContent: string; + justifyItems: string; + justifySelf: string; + left: string; + readonly length: number; + letterSpacing: string; + lightingColor: string; + lineBreak: string; + lineHeight: string; + listStyle: string; + listStyleImage: string; + listStylePosition: string; + listStyleType: string; + margin: string; + marginBlock: string; + marginBlockEnd: string; + marginBlockStart: string; + marginBottom: string; + marginInline: string; + marginInlineEnd: string; + marginInlineStart: string; + marginLeft: string; + marginRight: string; + marginTop: string; + marker: string; + markerEnd: string; + markerMid: string; + markerStart: string; + mask: string; + maskType: string; + maxBlockSize: string; + maxHeight: string; + maxInlineSize: string; + maxWidth: string; + minBlockSize: string; + minHeight: string; + minInlineSize: string; + minWidth: string; + mixBlendMode: string; + objectFit: string; + objectPosition: string; + offset: string; + offsetAnchor: string; + offsetDistance: string; + offsetPath: string; + offsetRotate: string; + opacity: string; + order: string; + orphans: string; + outline: string; + outlineColor: string; + outlineOffset: string; + outlineStyle: string; + outlineWidth: string; + overflow: string; + overflowAnchor: string; + overflowWrap: string; + overflowX: string; + overflowY: string; + overscrollBehavior: string; + overscrollBehaviorBlock: string; + overscrollBehaviorInline: string; + overscrollBehaviorX: string; + overscrollBehaviorY: string; + padding: string; + paddingBlock: string; + paddingBlockEnd: string; + paddingBlockStart: string; + paddingBottom: string; + paddingInline: string; + paddingInlineEnd: string; + paddingInlineStart: string; + paddingLeft: string; + paddingRight: string; + paddingTop: string; + pageBreakAfter: string; + pageBreakBefore: string; + pageBreakInside: string; + paintOrder: string; + readonly parentRule: CSSRule | null; + perspective: string; + perspectiveOrigin: string; + placeContent: string; + placeItems: string; + placeSelf: string; + pointerEvents: string; + position: string; + quotes: string; + resize: string; + right: string; + rotate: string; + rowGap: string; + rubyPosition: string; + scale: string; + scrollBehavior: string; + scrollMargin: string; + scrollMarginBlock: string; + scrollMarginBlockEnd: string; + scrollMarginBlockStart: string; + scrollMarginBottom: string; + scrollMarginInline: string; + scrollMarginInlineEnd: string; + scrollMarginInlineStart: string; + scrollMarginLeft: string; + scrollMarginRight: string; + scrollMarginTop: string; + scrollPadding: string; + scrollPaddingBlock: string; + scrollPaddingBlockEnd: string; + scrollPaddingBlockStart: string; + scrollPaddingBottom: string; + scrollPaddingInline: string; + scrollPaddingInlineEnd: string; + scrollPaddingInlineStart: string; + scrollPaddingLeft: string; + scrollPaddingRight: string; + scrollPaddingTop: string; + scrollSnapAlign: string; + scrollSnapStop: string; + scrollSnapType: string; + shapeImageThreshold: string; + shapeMargin: string; + shapeOutside: string; + shapeRendering: string; + stopColor: string; + stopOpacity: string; + stroke: string; + strokeDasharray: string; + strokeDashoffset: string; + strokeLinecap: string; + strokeLinejoin: string; + strokeMiterlimit: string; + strokeOpacity: string; + strokeWidth: string; + tabSize: string; + tableLayout: string; + textAlign: string; + textAlignLast: string; + textAnchor: string; + textCombineUpright: string; + textDecoration: string; + textDecorationColor: string; + textDecorationLine: string; + textDecorationSkipInk: string; + textDecorationStyle: string; + textDecorationThickness: string; + textEmphasis: string; + textEmphasisColor: string; + textEmphasisPosition: string; + textEmphasisStyle: string; + textIndent: string; + textOrientation: string; + textOverflow: string; + textRendering: string; + textShadow: string; + textTransform: string; + textUnderlineOffset: string; + textUnderlinePosition: string; + top: string; + touchAction: string; + transform: string; + transformBox: string; + transformOrigin: string; + transformStyle: string; + transition: string; + transitionDelay: string; + transitionDuration: string; + transitionProperty: string; + transitionTimingFunction: string; + translate: string; + unicodeBidi: string; + userSelect: string; + verticalAlign: string; + visibility: string; + /** @deprecated This is a legacy alias of `alignContent`. */ + webkitAlignContent: string; + /** @deprecated This is a legacy alias of `alignItems`. */ + webkitAlignItems: string; + /** @deprecated This is a legacy alias of `alignSelf`. */ + webkitAlignSelf: string; + /** @deprecated This is a legacy alias of `animation`. */ + webkitAnimation: string; + /** @deprecated This is a legacy alias of `animationDelay`. */ + webkitAnimationDelay: string; + /** @deprecated This is a legacy alias of `animationDirection`. */ + webkitAnimationDirection: string; + /** @deprecated This is a legacy alias of `animationDuration`. */ + webkitAnimationDuration: string; + /** @deprecated This is a legacy alias of `animationFillMode`. */ + webkitAnimationFillMode: string; + /** @deprecated This is a legacy alias of `animationIterationCount`. */ + webkitAnimationIterationCount: string; + /** @deprecated This is a legacy alias of `animationName`. */ + webkitAnimationName: string; + /** @deprecated This is a legacy alias of `animationPlayState`. */ + webkitAnimationPlayState: string; + /** @deprecated This is a legacy alias of `animationTimingFunction`. */ + webkitAnimationTimingFunction: string; + /** @deprecated This is a legacy alias of `appearance`. */ + webkitAppearance: string; + /** @deprecated This is a legacy alias of `backfaceVisibility`. */ + webkitBackfaceVisibility: string; + /** @deprecated This is a legacy alias of `backgroundClip`. */ + webkitBackgroundClip: string; + /** @deprecated This is a legacy alias of `backgroundOrigin`. */ + webkitBackgroundOrigin: string; + /** @deprecated This is a legacy alias of `backgroundSize`. */ + webkitBackgroundSize: string; + /** @deprecated This is a legacy alias of `borderBottomLeftRadius`. */ + webkitBorderBottomLeftRadius: string; + /** @deprecated This is a legacy alias of `borderBottomRightRadius`. */ + webkitBorderBottomRightRadius: string; + /** @deprecated This is a legacy alias of `borderRadius`. */ + webkitBorderRadius: string; + /** @deprecated This is a legacy alias of `borderTopLeftRadius`. */ + webkitBorderTopLeftRadius: string; + /** @deprecated This is a legacy alias of `borderTopRightRadius`. */ + webkitBorderTopRightRadius: string; + /** @deprecated This is a legacy alias of `boxAlign`. */ + webkitBoxAlign: string; + /** @deprecated This is a legacy alias of `boxFlex`. */ + webkitBoxFlex: string; + /** @deprecated This is a legacy alias of `boxOrdinalGroup`. */ + webkitBoxOrdinalGroup: string; + /** @deprecated This is a legacy alias of `boxOrient`. */ + webkitBoxOrient: string; + /** @deprecated This is a legacy alias of `boxPack`. */ + webkitBoxPack: string; + /** @deprecated This is a legacy alias of `boxShadow`. */ + webkitBoxShadow: string; + /** @deprecated This is a legacy alias of `boxSizing`. */ + webkitBoxSizing: string; + /** @deprecated This is a legacy alias of `filter`. */ + webkitFilter: string; + /** @deprecated This is a legacy alias of `flex`. */ + webkitFlex: string; + /** @deprecated This is a legacy alias of `flexBasis`. */ + webkitFlexBasis: string; + /** @deprecated This is a legacy alias of `flexDirection`. */ + webkitFlexDirection: string; + /** @deprecated This is a legacy alias of `flexFlow`. */ + webkitFlexFlow: string; + /** @deprecated This is a legacy alias of `flexGrow`. */ + webkitFlexGrow: string; + /** @deprecated This is a legacy alias of `flexShrink`. */ + webkitFlexShrink: string; + /** @deprecated This is a legacy alias of `flexWrap`. */ + webkitFlexWrap: string; + /** @deprecated This is a legacy alias of `justifyContent`. */ + webkitJustifyContent: string; + webkitLineClamp: string; + /** @deprecated This is a legacy alias of `mask`. */ + webkitMask: string; + /** @deprecated This is a legacy alias of `maskBorder`. */ + webkitMaskBoxImage: string; + /** @deprecated This is a legacy alias of `maskBorderOutset`. */ + webkitMaskBoxImageOutset: string; + /** @deprecated This is a legacy alias of `maskBorderRepeat`. */ + webkitMaskBoxImageRepeat: string; + /** @deprecated This is a legacy alias of `maskBorderSlice`. */ + webkitMaskBoxImageSlice: string; + /** @deprecated This is a legacy alias of `maskBorderSource`. */ + webkitMaskBoxImageSource: string; + /** @deprecated This is a legacy alias of `maskBorderWidth`. */ + webkitMaskBoxImageWidth: string; + /** @deprecated This is a legacy alias of `maskClip`. */ + webkitMaskClip: string; + webkitMaskComposite: string; + /** @deprecated This is a legacy alias of `maskImage`. */ + webkitMaskImage: string; + /** @deprecated This is a legacy alias of `maskOrigin`. */ + webkitMaskOrigin: string; + /** @deprecated This is a legacy alias of `maskPosition`. */ + webkitMaskPosition: string; + /** @deprecated This is a legacy alias of `maskRepeat`. */ + webkitMaskRepeat: string; + /** @deprecated This is a legacy alias of `maskSize`. */ + webkitMaskSize: string; + /** @deprecated This is a legacy alias of `order`. */ + webkitOrder: string; + /** @deprecated This is a legacy alias of `perspective`. */ + webkitPerspective: string; + /** @deprecated This is a legacy alias of `perspectiveOrigin`. */ + webkitPerspectiveOrigin: string; + webkitTextFillColor: string; + webkitTextStroke: string; + webkitTextStrokeColor: string; + webkitTextStrokeWidth: string; + /** @deprecated This is a legacy alias of `transform`. */ + webkitTransform: string; + /** @deprecated This is a legacy alias of `transformOrigin`. */ + webkitTransformOrigin: string; + /** @deprecated This is a legacy alias of `transformStyle`. */ + webkitTransformStyle: string; + /** @deprecated This is a legacy alias of `transition`. */ + webkitTransition: string; + /** @deprecated This is a legacy alias of `transitionDelay`. */ + webkitTransitionDelay: string; + /** @deprecated This is a legacy alias of `transitionDuration`. */ + webkitTransitionDuration: string; + /** @deprecated This is a legacy alias of `transitionProperty`. */ + webkitTransitionProperty: string; + /** @deprecated This is a legacy alias of `transitionTimingFunction`. */ + webkitTransitionTimingFunction: string; + /** @deprecated This is a legacy alias of `userSelect`. */ + webkitUserSelect: string; + whiteSpace: string; + widows: string; + width: string; + willChange: string; + wordBreak: string; + wordSpacing: string; + /** @deprecated */ + wordWrap: string; + writingMode: string; + zIndex: string; + getPropertyPriority(property: string): string; + getPropertyValue(property: string): string; + item(index: number): string; + removeProperty(property: string): string; + setProperty(property: string, value: string | null, priority?: string): void; + [index: number]: string; +} + +declare var CSSStyleDeclaration: { + prototype: CSSStyleDeclaration; + new(): CSSStyleDeclaration; +}; + +/** CSSStyleRule represents a single CSS style rule. It implements the CSSRule interface with a type value of 1 (CSSRule.STYLE_RULE). */ +interface CSSStyleRule extends CSSRule { + selectorText: string; + readonly style: CSSStyleDeclaration; +} + +declare var CSSStyleRule: { + prototype: CSSStyleRule; + new(): CSSStyleRule; +}; + +/** A single CSS style sheet. It inherits properties and methods from its parent, StyleSheet. */ +interface CSSStyleSheet extends StyleSheet { + readonly cssRules: CSSRuleList; + readonly ownerRule: CSSRule | null; + /** @deprecated */ + readonly rules: CSSRuleList; + /** @deprecated */ + addRule(selector?: string, style?: string, index?: number): number; + deleteRule(index: number): void; + insertRule(rule: string, index?: number): number; + /** @deprecated */ + removeRule(index?: number): void; +} + +declare var CSSStyleSheet: { + prototype: CSSStyleSheet; + new(options?: CSSStyleSheetInit): CSSStyleSheet; +}; + +/** An object representing a single CSS @supports at-rule. It implements the CSSConditionRule interface, and therefore the CSSRule and CSSGroupingRule interfaces with a type value of 12 (CSSRule.SUPPORTS_RULE). */ +interface CSSSupportsRule extends CSSConditionRule { +} + +declare var CSSSupportsRule: { + prototype: CSSSupportsRule; + new(): CSSSupportsRule; +}; + +interface CSSTransition extends Animation { + readonly transitionProperty: string; + addEventListener(type: K, listener: (this: CSSTransition, ev: AnimationEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: CSSTransition, ev: AnimationEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var CSSTransition: { + prototype: CSSTransition; + new(): CSSTransition; +}; + +/** + * Provides a storage mechanism for Request / Response object pairs that are cached, for example as part of the ServiceWorker life cycle. Note that the Cache interface is exposed to windowed scopes as well as workers. You don't have to use it in conjunction with service workers, even though it is defined in the service worker spec. + * Available only in secure contexts. + */ +interface Cache { + add(request: RequestInfo): Promise; + addAll(requests: RequestInfo[]): Promise; + delete(request: RequestInfo, options?: CacheQueryOptions): Promise; + keys(request?: RequestInfo, options?: CacheQueryOptions): Promise>; + match(request: RequestInfo, options?: CacheQueryOptions): Promise; + matchAll(request?: RequestInfo, options?: CacheQueryOptions): Promise>; + put(request: RequestInfo, response: Response): Promise; +} + +declare var Cache: { + prototype: Cache; + new(): Cache; +}; + +/** + * The storage for Cache objects. + * Available only in secure contexts. + */ +interface CacheStorage { + delete(cacheName: string): Promise; + has(cacheName: string): Promise; + keys(): Promise; + match(request: RequestInfo, options?: MultiCacheQueryOptions): Promise; + open(cacheName: string): Promise; +} + +declare var CacheStorage: { + prototype: CacheStorage; + new(): CacheStorage; +}; + +interface CanvasCompositing { + globalAlpha: number; + globalCompositeOperation: string; +} + +interface CanvasDrawImage { + drawImage(image: CanvasImageSource, dx: number, dy: number): void; + drawImage(image: CanvasImageSource, dx: number, dy: number, dw: number, dh: number): void; + drawImage(image: CanvasImageSource, sx: number, sy: number, sw: number, sh: number, dx: number, dy: number, dw: number, dh: number): void; +} + +interface CanvasDrawPath { + beginPath(): void; + clip(fillRule?: CanvasFillRule): void; + clip(path: Path2D, fillRule?: CanvasFillRule): void; + fill(fillRule?: CanvasFillRule): void; + fill(path: Path2D, fillRule?: CanvasFillRule): void; + isPointInPath(x: number, y: number, fillRule?: CanvasFillRule): boolean; + isPointInPath(path: Path2D, x: number, y: number, fillRule?: CanvasFillRule): boolean; + isPointInStroke(x: number, y: number): boolean; + isPointInStroke(path: Path2D, x: number, y: number): boolean; + stroke(): void; + stroke(path: Path2D): void; +} + +interface CanvasFillStrokeStyles { + fillStyle: string | CanvasGradient | CanvasPattern; + strokeStyle: string | CanvasGradient | CanvasPattern; + createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; + createPattern(image: CanvasImageSource, repetition: string | null): CanvasPattern | null; + createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient; +} + +interface CanvasFilters { + filter: string; +} + +/** An opaque object describing a gradient. It is returned by the methods CanvasRenderingContext2D.createLinearGradient() or CanvasRenderingContext2D.createRadialGradient(). */ +interface CanvasGradient { + /** + * Adds a color stop with the given color to the gradient at the given offset. 0.0 is the offset at one end of the gradient, 1.0 is the offset at the other end. + * + * Throws an "IndexSizeError" DOMException if the offset is out of range. Throws a "SyntaxError" DOMException if the color cannot be parsed. + */ + addColorStop(offset: number, color: string): void; +} + +declare var CanvasGradient: { + prototype: CanvasGradient; + new(): CanvasGradient; +}; + +interface CanvasImageData { + createImageData(sw: number, sh: number, settings?: ImageDataSettings): ImageData; + createImageData(imagedata: ImageData): ImageData; + getImageData(sx: number, sy: number, sw: number, sh: number, settings?: ImageDataSettings): ImageData; + putImageData(imagedata: ImageData, dx: number, dy: number): void; + putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX: number, dirtyY: number, dirtyWidth: number, dirtyHeight: number): void; +} + +interface CanvasImageSmoothing { + imageSmoothingEnabled: boolean; + imageSmoothingQuality: ImageSmoothingQuality; +} + +interface CanvasPath { + arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void; + arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; + bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void; + closePath(): void; + ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void; + lineTo(x: number, y: number): void; + moveTo(x: number, y: number): void; + quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; + rect(x: number, y: number, w: number, h: number): void; +} + +interface CanvasPathDrawingStyles { + lineCap: CanvasLineCap; + lineDashOffset: number; + lineJoin: CanvasLineJoin; + lineWidth: number; + miterLimit: number; + getLineDash(): number[]; + setLineDash(segments: number[]): void; +} + +/** An opaque object describing a pattern, based on an image, a canvas, or a video, created by the CanvasRenderingContext2D.createPattern() method. */ +interface CanvasPattern { + /** Sets the transformation matrix that will be used when rendering the pattern during a fill or stroke painting operation. */ + setTransform(transform?: DOMMatrix2DInit): void; +} + +declare var CanvasPattern: { + prototype: CanvasPattern; + new(): CanvasPattern; +}; + +interface CanvasRect { + clearRect(x: number, y: number, w: number, h: number): void; + fillRect(x: number, y: number, w: number, h: number): void; + strokeRect(x: number, y: number, w: number, h: number): void; +} + +/** The CanvasRenderingContext2D interface, part of the Canvas API, provides the 2D rendering context for the drawing surface of a element. It is used for drawing shapes, text, images, and other objects. */ +interface CanvasRenderingContext2D extends CanvasCompositing, CanvasDrawImage, CanvasDrawPath, CanvasFillStrokeStyles, CanvasFilters, CanvasImageData, CanvasImageSmoothing, CanvasPath, CanvasPathDrawingStyles, CanvasRect, CanvasShadowStyles, CanvasState, CanvasText, CanvasTextDrawingStyles, CanvasTransform, CanvasUserInterface { + readonly canvas: HTMLCanvasElement; + getContextAttributes(): CanvasRenderingContext2DSettings; +} + +declare var CanvasRenderingContext2D: { + prototype: CanvasRenderingContext2D; + new(): CanvasRenderingContext2D; +}; + +interface CanvasShadowStyles { + shadowBlur: number; + shadowColor: string; + shadowOffsetX: number; + shadowOffsetY: number; +} + +interface CanvasState { + restore(): void; + save(): void; +} + +interface CanvasText { + fillText(text: string, x: number, y: number, maxWidth?: number): void; + measureText(text: string): TextMetrics; + strokeText(text: string, x: number, y: number, maxWidth?: number): void; +} + +interface CanvasTextDrawingStyles { + direction: CanvasDirection; + font: string; + textAlign: CanvasTextAlign; + textBaseline: CanvasTextBaseline; +} + +interface CanvasTransform { + getTransform(): DOMMatrix; + resetTransform(): void; + rotate(angle: number): void; + scale(x: number, y: number): void; + setTransform(a: number, b: number, c: number, d: number, e: number, f: number): void; + setTransform(transform?: DOMMatrix2DInit): void; + transform(a: number, b: number, c: number, d: number, e: number, f: number): void; + translate(x: number, y: number): void; +} + +interface CanvasUserInterface { + drawFocusIfNeeded(element: Element): void; + drawFocusIfNeeded(path: Path2D, element: Element): void; +} + +/** The ChannelMergerNode interface, often used in conjunction with its opposite, ChannelSplitterNode, reunites different mono inputs into a single output. Each input is used to fill a channel of the output. This is useful for accessing each channels separately, e.g. for performing channel mixing where gain must be separately controlled on each channel. */ +interface ChannelMergerNode extends AudioNode { +} + +declare var ChannelMergerNode: { + prototype: ChannelMergerNode; + new(context: BaseAudioContext, options?: ChannelMergerOptions): ChannelMergerNode; +}; + +/** The ChannelSplitterNode interface, often used in conjunction with its opposite, ChannelMergerNode, separates the different channels of an audio source into a set of mono outputs. This is useful for accessing each channel separately, e.g. for performing channel mixing where gain must be separately controlled on each channel. */ +interface ChannelSplitterNode extends AudioNode { +} + +declare var ChannelSplitterNode: { + prototype: ChannelSplitterNode; + new(context: BaseAudioContext, options?: ChannelSplitterOptions): ChannelSplitterNode; +}; + +/** The CharacterData abstract interface represents a Node object that contains characters. This is an abstract interface, meaning there aren't any object of type CharacterData: it is implemented by other interfaces, like Text, Comment, or ProcessingInstruction which aren't abstract. */ +interface CharacterData extends Node, ChildNode, NonDocumentTypeChildNode { + data: string; + readonly length: number; + readonly ownerDocument: Document; + appendData(data: string): void; + deleteData(offset: number, count: number): void; + insertData(offset: number, data: string): void; + replaceData(offset: number, count: number, data: string): void; + substringData(offset: number, count: number): string; +} + +declare var CharacterData: { + prototype: CharacterData; + new(): CharacterData; +}; + +interface ChildNode extends Node { + /** + * Inserts nodes just after node, while replacing strings in nodes with equivalent Text nodes. + * + * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated. + */ + after(...nodes: (Node | string)[]): void; + /** + * Inserts nodes just before node, while replacing strings in nodes with equivalent Text nodes. + * + * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated. + */ + before(...nodes: (Node | string)[]): void; + /** Removes node. */ + remove(): void; + /** + * Replaces node with nodes, while replacing strings in nodes with equivalent Text nodes. + * + * Throws a "HierarchyRequestError" DOMException if the constraints of the node tree are violated. + */ + replaceWith(...nodes: (Node | string)[]): void; +} + +/** @deprecated */ +interface ClientRect extends DOMRect { +} + +/** Available only in secure contexts. */ +interface Clipboard extends EventTarget { + read(): Promise; + readText(): Promise; + write(data: ClipboardItems): Promise; + writeText(data: string): Promise; +} + +declare var Clipboard: { + prototype: Clipboard; + new(): Clipboard; +}; + +/** Events providing information related to modification of the clipboard, that is cut, copy, and paste events. */ +interface ClipboardEvent extends Event { + readonly clipboardData: DataTransfer | null; +} + +declare var ClipboardEvent: { + prototype: ClipboardEvent; + new(type: string, eventInitDict?: ClipboardEventInit): ClipboardEvent; +}; + +interface ClipboardItem { + readonly types: ReadonlyArray; + getType(type: string): Promise; +} + +declare var ClipboardItem: { + prototype: ClipboardItem; + new(items: Record>, options?: ClipboardItemOptions): ClipboardItem; +}; + +/** A CloseEvent is sent to clients using WebSockets when the connection is closed. This is delivered to the listener indicated by the WebSocket object's onclose attribute. */ +interface CloseEvent extends Event { + /** Returns the WebSocket connection close code provided by the server. */ + readonly code: number; + /** Returns the WebSocket connection close reason provided by the server. */ + readonly reason: string; + /** Returns true if the connection closed cleanly; false otherwise. */ + readonly wasClean: boolean; +} + +declare var CloseEvent: { + prototype: CloseEvent; + new(type: string, eventInitDict?: CloseEventInit): CloseEvent; +}; + +/** Textual notations within markup; although it is generally not visually shown, such comments are available to be read in the source view. */ +interface Comment extends CharacterData { +} + +declare var Comment: { + prototype: Comment; + new(data?: string): Comment; +}; + +/** The DOM CompositionEvent represents events that occur due to the user indirectly entering text. */ +interface CompositionEvent extends UIEvent { + readonly data: string; + /** @deprecated */ + initCompositionEvent(typeArg: string, bubblesArg?: boolean, cancelableArg?: boolean, viewArg?: WindowProxy | null, dataArg?: string): void; +} + +declare var CompositionEvent: { + prototype: CompositionEvent; + new(type: string, eventInitDict?: CompositionEventInit): CompositionEvent; +}; + +interface ConstantSourceNode extends AudioScheduledSourceNode { + readonly offset: AudioParam; + addEventListener(type: K, listener: (this: ConstantSourceNode, ev: AudioScheduledSourceNodeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: ConstantSourceNode, ev: AudioScheduledSourceNodeEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var ConstantSourceNode: { + prototype: ConstantSourceNode; + new(context: BaseAudioContext, options?: ConstantSourceOptions): ConstantSourceNode; +}; + +/** An AudioNode that performs a Linear Convolution on a given AudioBuffer, often used to achieve a reverb effect. A ConvolverNode always has exactly one input and one output. */ +interface ConvolverNode extends AudioNode { + buffer: AudioBuffer | null; + normalize: boolean; +} + +declare var ConvolverNode: { + prototype: ConvolverNode; + new(context: BaseAudioContext, options?: ConvolverOptions): ConvolverNode; +}; + +/** This Streams API interface provides a built-in byte length queuing strategy that can be used when constructing streams. */ +interface CountQueuingStrategy extends QueuingStrategy { + readonly highWaterMark: number; + readonly size: QueuingStrategySize; +} + +declare var CountQueuingStrategy: { + prototype: CountQueuingStrategy; + new(init: QueuingStrategyInit): CountQueuingStrategy; +}; + +/** Available only in secure contexts. */ +interface Credential { + readonly id: string; + readonly type: string; +} + +declare var Credential: { + prototype: Credential; + new(): Credential; +}; + +/** Available only in secure contexts. */ +interface CredentialsContainer { + create(options?: CredentialCreationOptions): Promise; + get(options?: CredentialRequestOptions): Promise; + preventSilentAccess(): Promise; + store(credential: Credential): Promise; +} + +declare var CredentialsContainer: { + prototype: CredentialsContainer; + new(): CredentialsContainer; +}; + +/** Basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives. */ +interface Crypto { + /** Available only in secure contexts. */ + readonly subtle: SubtleCrypto; + getRandomValues(array: T): T; +} + +declare var Crypto: { + prototype: Crypto; + new(): Crypto; +}; + +/** + * The CryptoKey dictionary of the Web Crypto API represents a cryptographic key. + * Available only in secure contexts. + */ +interface CryptoKey { + readonly algorithm: KeyAlgorithm; + readonly extractable: boolean; + readonly type: KeyType; + readonly usages: KeyUsage[]; +} + +declare var CryptoKey: { + prototype: CryptoKey; + new(): CryptoKey; +}; + +interface CustomElementRegistry { + define(name: string, constructor: CustomElementConstructor, options?: ElementDefinitionOptions): void; + get(name: string): CustomElementConstructor | undefined; + upgrade(root: Node): void; + whenDefined(name: string): Promise; +} + +declare var CustomElementRegistry: { + prototype: CustomElementRegistry; + new(): CustomElementRegistry; +}; + +interface CustomEvent extends Event { + /** Returns any custom data event was created with. Typically used for synthetic events. */ + readonly detail: T; + /** @deprecated */ + initCustomEvent(type: string, bubbles?: boolean, cancelable?: boolean, detail?: T): void; +} + +declare var CustomEvent: { + prototype: CustomEvent; + new(type: string, eventInitDict?: CustomEventInit): CustomEvent; +}; + +/** An abnormal event (called an exception) which occurs as a result of calling a method or accessing a property of a web API. */ +interface DOMException extends Error { + readonly code: number; + readonly message: string; + readonly name: string; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; +} + +declare var DOMException: { + prototype: DOMException; + new(message?: string, name?: string): DOMException; + readonly ABORT_ERR: number; + readonly DATA_CLONE_ERR: number; + readonly DOMSTRING_SIZE_ERR: number; + readonly HIERARCHY_REQUEST_ERR: number; + readonly INDEX_SIZE_ERR: number; + readonly INUSE_ATTRIBUTE_ERR: number; + readonly INVALID_ACCESS_ERR: number; + readonly INVALID_CHARACTER_ERR: number; + readonly INVALID_MODIFICATION_ERR: number; + readonly INVALID_NODE_TYPE_ERR: number; + readonly INVALID_STATE_ERR: number; + readonly NAMESPACE_ERR: number; + readonly NETWORK_ERR: number; + readonly NOT_FOUND_ERR: number; + readonly NOT_SUPPORTED_ERR: number; + readonly NO_DATA_ALLOWED_ERR: number; + readonly NO_MODIFICATION_ALLOWED_ERR: number; + readonly QUOTA_EXCEEDED_ERR: number; + readonly SECURITY_ERR: number; + readonly SYNTAX_ERR: number; + readonly TIMEOUT_ERR: number; + readonly TYPE_MISMATCH_ERR: number; + readonly URL_MISMATCH_ERR: number; + readonly VALIDATION_ERR: number; + readonly WRONG_DOCUMENT_ERR: number; +}; + +/** An object providing methods which are not dependent on any particular document. Such an object is returned by the Document.implementation property. */ +interface DOMImplementation { + createDocument(namespace: string | null, qualifiedName: string | null, doctype?: DocumentType | null): XMLDocument; + createDocumentType(qualifiedName: string, publicId: string, systemId: string): DocumentType; + createHTMLDocument(title?: string): Document; + /** @deprecated */ + hasFeature(...args: any[]): true; +} + +declare var DOMImplementation: { + prototype: DOMImplementation; + new(): DOMImplementation; +}; + +interface DOMMatrix extends DOMMatrixReadOnly { + a: number; + b: number; + c: number; + d: number; + e: number; + f: number; + m11: number; + m12: number; + m13: number; + m14: number; + m21: number; + m22: number; + m23: number; + m24: number; + m31: number; + m32: number; + m33: number; + m34: number; + m41: number; + m42: number; + m43: number; + m44: number; + invertSelf(): DOMMatrix; + multiplySelf(other?: DOMMatrixInit): DOMMatrix; + preMultiplySelf(other?: DOMMatrixInit): DOMMatrix; + rotateAxisAngleSelf(x?: number, y?: number, z?: number, angle?: number): DOMMatrix; + rotateFromVectorSelf(x?: number, y?: number): DOMMatrix; + rotateSelf(rotX?: number, rotY?: number, rotZ?: number): DOMMatrix; + scale3dSelf(scale?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix; + scaleSelf(scaleX?: number, scaleY?: number, scaleZ?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix; + setMatrixValue(transformList: string): DOMMatrix; + skewXSelf(sx?: number): DOMMatrix; + skewYSelf(sy?: number): DOMMatrix; + translateSelf(tx?: number, ty?: number, tz?: number): DOMMatrix; +} + +declare var DOMMatrix: { + prototype: DOMMatrix; + new(init?: string | number[]): DOMMatrix; + fromFloat32Array(array32: Float32Array): DOMMatrix; + fromFloat64Array(array64: Float64Array): DOMMatrix; + fromMatrix(other?: DOMMatrixInit): DOMMatrix; +}; + +type SVGMatrix = DOMMatrix; +declare var SVGMatrix: typeof DOMMatrix; + +type WebKitCSSMatrix = DOMMatrix; +declare var WebKitCSSMatrix: typeof DOMMatrix; + +interface DOMMatrixReadOnly { + readonly a: number; + readonly b: number; + readonly c: number; + readonly d: number; + readonly e: number; + readonly f: number; + readonly is2D: boolean; + readonly isIdentity: boolean; + readonly m11: number; + readonly m12: number; + readonly m13: number; + readonly m14: number; + readonly m21: number; + readonly m22: number; + readonly m23: number; + readonly m24: number; + readonly m31: number; + readonly m32: number; + readonly m33: number; + readonly m34: number; + readonly m41: number; + readonly m42: number; + readonly m43: number; + readonly m44: number; + flipX(): DOMMatrix; + flipY(): DOMMatrix; + inverse(): DOMMatrix; + multiply(other?: DOMMatrixInit): DOMMatrix; + rotate(rotX?: number, rotY?: number, rotZ?: number): DOMMatrix; + rotateAxisAngle(x?: number, y?: number, z?: number, angle?: number): DOMMatrix; + rotateFromVector(x?: number, y?: number): DOMMatrix; + scale(scaleX?: number, scaleY?: number, scaleZ?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix; + scale3d(scale?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix; + /** @deprecated */ + scaleNonUniform(scaleX?: number, scaleY?: number): DOMMatrix; + skewX(sx?: number): DOMMatrix; + skewY(sy?: number): DOMMatrix; + toFloat32Array(): Float32Array; + toFloat64Array(): Float64Array; + toJSON(): any; + transformPoint(point?: DOMPointInit): DOMPoint; + translate(tx?: number, ty?: number, tz?: number): DOMMatrix; + toString(): string; +} + +declare var DOMMatrixReadOnly: { + prototype: DOMMatrixReadOnly; + new(init?: string | number[]): DOMMatrixReadOnly; + fromFloat32Array(array32: Float32Array): DOMMatrixReadOnly; + fromFloat64Array(array64: Float64Array): DOMMatrixReadOnly; + fromMatrix(other?: DOMMatrixInit): DOMMatrixReadOnly; + toString(): string; +}; + +/** Provides the ability to parse XML or HTML source code from a string into a DOM Document. */ +interface DOMParser { + /** + * Parses string using either the HTML or XML parser, according to type, and returns the resulting Document. type can be "text/html" (which will invoke the HTML parser), or any of "text/xml", "application/xml", "application/xhtml+xml", or "image/svg+xml" (which will invoke the XML parser). + * + * For the XML parser, if string cannot be parsed, then the returned Document will contain elements describing the resulting error. + * + * Note that script elements are not evaluated during parsing, and the resulting document's encoding will always be UTF-8. + * + * Values other than the above for type will cause a TypeError exception to be thrown. + */ + parseFromString(string: string, type: DOMParserSupportedType): Document; +} + +declare var DOMParser: { + prototype: DOMParser; + new(): DOMParser; +}; + +interface DOMPoint extends DOMPointReadOnly { + w: number; + x: number; + y: number; + z: number; +} + +declare var DOMPoint: { + prototype: DOMPoint; + new(x?: number, y?: number, z?: number, w?: number): DOMPoint; + fromPoint(other?: DOMPointInit): DOMPoint; +}; + +type SVGPoint = DOMPoint; +declare var SVGPoint: typeof DOMPoint; + +interface DOMPointReadOnly { + readonly w: number; + readonly x: number; + readonly y: number; + readonly z: number; + matrixTransform(matrix?: DOMMatrixInit): DOMPoint; + toJSON(): any; +} + +declare var DOMPointReadOnly: { + prototype: DOMPointReadOnly; + new(x?: number, y?: number, z?: number, w?: number): DOMPointReadOnly; + fromPoint(other?: DOMPointInit): DOMPointReadOnly; +}; + +interface DOMQuad { + readonly p1: DOMPoint; + readonly p2: DOMPoint; + readonly p3: DOMPoint; + readonly p4: DOMPoint; + getBounds(): DOMRect; + toJSON(): any; +} + +declare var DOMQuad: { + prototype: DOMQuad; + new(p1?: DOMPointInit, p2?: DOMPointInit, p3?: DOMPointInit, p4?: DOMPointInit): DOMQuad; + fromQuad(other?: DOMQuadInit): DOMQuad; + fromRect(other?: DOMRectInit): DOMQuad; +}; + +interface DOMRect extends DOMRectReadOnly { + height: number; + width: number; + x: number; + y: number; +} + +declare var DOMRect: { + prototype: DOMRect; + new(x?: number, y?: number, width?: number, height?: number): DOMRect; + fromRect(other?: DOMRectInit): DOMRect; +}; + +type SVGRect = DOMRect; +declare var SVGRect: typeof DOMRect; + +interface DOMRectList { + readonly length: number; + item(index: number): DOMRect | null; + [index: number]: DOMRect; +} + +declare var DOMRectList: { + prototype: DOMRectList; + new(): DOMRectList; +}; + +interface DOMRectReadOnly { + readonly bottom: number; + readonly height: number; + readonly left: number; + readonly right: number; + readonly top: number; + readonly width: number; + readonly x: number; + readonly y: number; + toJSON(): any; +} + +declare var DOMRectReadOnly: { + prototype: DOMRectReadOnly; + new(x?: number, y?: number, width?: number, height?: number): DOMRectReadOnly; + fromRect(other?: DOMRectInit): DOMRectReadOnly; +}; + +/** A type returned by some APIs which contains a list of DOMString (strings). */ +interface DOMStringList { + /** Returns the number of strings in strings. */ + readonly length: number; + /** Returns true if strings contains string, and false otherwise. */ + contains(string: string): boolean; + /** Returns the string with index index from strings. */ + item(index: number): string | null; + [index: number]: string; +} + +declare var DOMStringList: { + prototype: DOMStringList; + new(): DOMStringList; +}; + +/** Used by the dataset HTML attribute to represent data for custom attributes added to elements. */ +interface DOMStringMap { + [name: string]: string | undefined; +} + +declare var DOMStringMap: { + prototype: DOMStringMap; + new(): DOMStringMap; +}; + +/** A set of space-separated tokens. Such a set is returned by Element.classList, HTMLLinkElement.relList, HTMLAnchorElement.relList, HTMLAreaElement.relList, HTMLIframeElement.sandbox, or HTMLOutputElement.htmlFor. It is indexed beginning with 0 as with JavaScript Array objects. DOMTokenList is always case-sensitive. */ +interface DOMTokenList { + /** Returns the number of tokens. */ + readonly length: number; + /** + * Returns the associated set as string. + * + * Can be set, to change the associated attribute. + */ + value: string; + toString(): string; + /** + * Adds all arguments passed, except those already present. + * + * Throws a "SyntaxError" DOMException if one of the arguments is the empty string. + * + * Throws an "InvalidCharacterError" DOMException if one of the arguments contains any ASCII whitespace. + */ + add(...tokens: string[]): void; + /** Returns true if token is present, and false otherwise. */ + contains(token: string): boolean; + /** Returns the token with index index. */ + item(index: number): string | null; + /** + * Removes arguments passed, if they are present. + * + * Throws a "SyntaxError" DOMException if one of the arguments is the empty string. + * + * Throws an "InvalidCharacterError" DOMException if one of the arguments contains any ASCII whitespace. + */ + remove(...tokens: string[]): void; + /** + * Replaces token with newToken. + * + * Returns true if token was replaced with newToken, and false otherwise. + * + * Throws a "SyntaxError" DOMException if one of the arguments is the empty string. + * + * Throws an "InvalidCharacterError" DOMException if one of the arguments contains any ASCII whitespace. + */ + replace(token: string, newToken: string): boolean; + /** + * Returns true if token is in the associated attribute's supported tokens. Returns false otherwise. + * + * Throws a TypeError if the associated attribute has no supported tokens defined. + */ + supports(token: string): boolean; + /** + * If force is not given, "toggles" token, removing it if it's present and adding it if it's not present. If force is true, adds token (same as add()). If force is false, removes token (same as remove()). + * + * Returns true if token is now present, and false otherwise. + * + * Throws a "SyntaxError" DOMException if token is empty. + * + * Throws an "InvalidCharacterError" DOMException if token contains any spaces. + */ + toggle(token: string, force?: boolean): boolean; + forEach(callbackfn: (value: string, key: number, parent: DOMTokenList) => void, thisArg?: any): void; + [index: number]: string; +} + +declare var DOMTokenList: { + prototype: DOMTokenList; + new(): DOMTokenList; +}; + +/** Used to hold the data that is being dragged during a drag and drop operation. It may hold one or more data items, each of one or more data types. For more information about drag and drop, see HTML Drag and Drop API. */ +interface DataTransfer { + /** + * Returns the kind of operation that is currently selected. If the kind of operation isn't one of those that is allowed by the effectAllowed attribute, then the operation will fail. + * + * Can be set, to change the selected operation. + * + * The possible values are "none", "copy", "link", and "move". + */ + dropEffect: "none" | "copy" | "link" | "move"; + /** + * Returns the kinds of operations that are to be allowed. + * + * Can be set (during the dragstart event), to change the allowed operations. + * + * The possible values are "none", "copy", "copyLink", "copyMove", "link", "linkMove", "move", "all", and "uninitialized", + */ + effectAllowed: "none" | "copy" | "copyLink" | "copyMove" | "link" | "linkMove" | "move" | "all" | "uninitialized"; + /** Returns a FileList of the files being dragged, if any. */ + readonly files: FileList; + /** Returns a DataTransferItemList object, with the drag data. */ + readonly items: DataTransferItemList; + /** Returns a frozen array listing the formats that were set in the dragstart event. In addition, if any files are being dragged, then one of the types will be the string "Files". */ + readonly types: ReadonlyArray; + /** Removes the data of the specified formats. Removes all data if the argument is omitted. */ + clearData(format?: string): void; + /** Returns the specified data. If there is no such data, returns the empty string. */ + getData(format: string): string; + /** Adds the specified data. */ + setData(format: string, data: string): void; + /** Uses the given element to update the drag feedback, replacing any previously specified feedback. */ + setDragImage(image: Element, x: number, y: number): void; +} + +declare var DataTransfer: { + prototype: DataTransfer; + new(): DataTransfer; +}; + +/** One drag data item. During a drag operation, each drag event has a dataTransfer property which contains a list of drag data items. Each item in the list is a DataTransferItem object. */ +interface DataTransferItem { + /** Returns the drag data item kind, one of: "string", "file". */ + readonly kind: string; + /** Returns the drag data item type string. */ + readonly type: string; + /** Returns a File object, if the drag data item kind is File. */ + getAsFile(): File | null; + /** Invokes the callback with the string data as the argument, if the drag data item kind is text. */ + getAsString(callback: FunctionStringCallback | null): void; + webkitGetAsEntry(): FileSystemEntry | null; +} + +declare var DataTransferItem: { + prototype: DataTransferItem; + new(): DataTransferItem; +}; + +/** A list of DataTransferItem objects representing items being dragged. During a drag operation, each DragEvent has a dataTransfer property and that property is a DataTransferItemList. */ +interface DataTransferItemList { + /** Returns the number of items in the drag data store. */ + readonly length: number; + /** Adds a new entry for the given data to the drag data store. If the data is plain text then a type string has to be provided also. */ + add(data: string, type: string): DataTransferItem | null; + add(data: File): DataTransferItem | null; + /** Removes all the entries in the drag data store. */ + clear(): void; + /** Removes the indexth entry in the drag data store. */ + remove(index: number): void; + [index: number]: DataTransferItem; +} + +declare var DataTransferItemList: { + prototype: DataTransferItemList; + new(): DataTransferItemList; +}; + +/** A delay-line; an AudioNode audio-processing module that causes a delay between the arrival of an input data and its propagation to the output. */ +interface DelayNode extends AudioNode { + readonly delayTime: AudioParam; +} + +declare var DelayNode: { + prototype: DelayNode; + new(context: BaseAudioContext, options?: DelayOptions): DelayNode; +}; + +/** + * The DeviceMotionEvent provides web developers with information about the speed of changes for the device's position and orientation. + * Available only in secure contexts. + */ +interface DeviceMotionEvent extends Event { + readonly acceleration: DeviceMotionEventAcceleration | null; + readonly accelerationIncludingGravity: DeviceMotionEventAcceleration | null; + readonly interval: number; + readonly rotationRate: DeviceMotionEventRotationRate | null; +} + +declare var DeviceMotionEvent: { + prototype: DeviceMotionEvent; + new(type: string, eventInitDict?: DeviceMotionEventInit): DeviceMotionEvent; +}; + +/** Available only in secure contexts. */ +interface DeviceMotionEventAcceleration { + readonly x: number | null; + readonly y: number | null; + readonly z: number | null; +} + +/** Available only in secure contexts. */ +interface DeviceMotionEventRotationRate { + readonly alpha: number | null; + readonly beta: number | null; + readonly gamma: number | null; +} + +/** + * The DeviceOrientationEvent provides web developers with information from the physical orientation of the device running the web page. + * Available only in secure contexts. + */ +interface DeviceOrientationEvent extends Event { + readonly absolute: boolean; + readonly alpha: number | null; + readonly beta: number | null; + readonly gamma: number | null; +} + +declare var DeviceOrientationEvent: { + prototype: DeviceOrientationEvent; + new(type: string, eventInitDict?: DeviceOrientationEventInit): DeviceOrientationEvent; +}; + +interface DocumentEventMap extends DocumentAndElementEventHandlersEventMap, GlobalEventHandlersEventMap { + "fullscreenchange": Event; + "fullscreenerror": Event; + "pointerlockchange": Event; + "pointerlockerror": Event; + "readystatechange": Event; + "visibilitychange": Event; +} + +/** Any web page loaded in the browser and serves as an entry point into the web page's content, which is the DOM tree. */ +interface Document extends Node, DocumentAndElementEventHandlers, DocumentOrShadowRoot, FontFaceSource, GlobalEventHandlers, NonElementParentNode, ParentNode, XPathEvaluatorBase { + /** Sets or gets the URL for the current document. */ + readonly URL: string; + /** + * Sets or gets the color of all active links in the document. + * @deprecated + */ + alinkColor: string; + /** + * Returns a reference to the collection of elements contained by the object. + * @deprecated + */ + readonly all: HTMLAllCollection; + /** + * Retrieves a collection of all a objects that have a name and/or id property. Objects in this collection are in HTML source order. + * @deprecated + */ + readonly anchors: HTMLCollectionOf; + /** + * Retrieves a collection of all applet objects in the document. + * @deprecated + */ + readonly applets: HTMLCollection; + /** + * Deprecated. Sets or retrieves a value that indicates the background color behind the object. + * @deprecated + */ + bgColor: string; + /** Specifies the beginning and end of the document body. */ + body: HTMLElement; + /** Returns document's encoding. */ + readonly characterSet: string; + /** + * Gets or sets the character set used to encode the object. + * @deprecated This is a legacy alias of `characterSet`. + */ + readonly charset: string; + /** Gets a value that indicates whether standards-compliant mode is switched on for the object. */ + readonly compatMode: string; + /** Returns document's content type. */ + readonly contentType: string; + /** + * Returns the HTTP cookies that apply to the Document. If there are no cookies or cookies can't be applied to this resource, the empty string will be returned. + * + * Can be set, to add a new cookie to the element's set of HTTP cookies. + * + * If the contents are sandboxed into a unique origin (e.g. in an iframe with the sandbox attribute), a "SecurityError" DOMException will be thrown on getting and setting. + */ + cookie: string; + /** + * Returns the script element, or the SVG script element, that is currently executing, as long as the element represents a classic script. In the case of reentrant script execution, returns the one that most recently started executing amongst those that have not yet finished executing. + * + * Returns null if the Document is not currently executing a script or SVG script element (e.g., because the running script is an event handler, or a timeout), or if the currently executing script or SVG script element represents a module script. + */ + readonly currentScript: HTMLOrSVGScriptElement | null; + /** Returns the Window object of the active document. */ + readonly defaultView: (WindowProxy & typeof globalThis) | null; + /** Sets or gets a value that indicates whether the document can be edited. */ + designMode: string; + /** Sets or retrieves a value that indicates the reading order of the object. */ + dir: string; + /** Gets an object representing the document type declaration associated with the current document. */ + readonly doctype: DocumentType | null; + /** Gets a reference to the root node of the document. */ + readonly documentElement: HTMLElement; + /** Returns document's URL. */ + readonly documentURI: string; + /** Sets or gets the security domain of the document. */ + domain: string; + /** Retrieves a collection of all embed objects in the document. */ + readonly embeds: HTMLCollectionOf; + /** + * Sets or gets the foreground (text) color of the document. + * @deprecated + */ + fgColor: string; + /** Retrieves a collection, in source order, of all form objects in the document. */ + readonly forms: HTMLCollectionOf; + /** @deprecated */ + readonly fullscreen: boolean; + /** Returns true if document has the ability to display elements fullscreen and fullscreen is supported, or false otherwise. */ + readonly fullscreenEnabled: boolean; + /** Returns the head element. */ + readonly head: HTMLHeadElement; + readonly hidden: boolean; + /** Retrieves a collection, in source order, of img objects in the document. */ + readonly images: HTMLCollectionOf; + /** Gets the implementation object of the current document. */ + readonly implementation: DOMImplementation; + /** + * Returns the character encoding used to create the webpage that is loaded into the document object. + * @deprecated This is a legacy alias of `characterSet`. + */ + readonly inputEncoding: string; + /** Gets the date that the page was last modified, if the page supplies one. */ + readonly lastModified: string; + /** + * Sets or gets the color of the document links. + * @deprecated + */ + linkColor: string; + /** Retrieves a collection of all a objects that specify the href property and all area objects in the document. */ + readonly links: HTMLCollectionOf; + /** Contains information about the current URL. */ + get location(): Location; + set location(href: string | Location); + onfullscreenchange: ((this: Document, ev: Event) => any) | null; + onfullscreenerror: ((this: Document, ev: Event) => any) | null; + onpointerlockchange: ((this: Document, ev: Event) => any) | null; + onpointerlockerror: ((this: Document, ev: Event) => any) | null; + /** + * Fires when the state of the object has changed. + * @param ev The event + */ + onreadystatechange: ((this: Document, ev: Event) => any) | null; + onvisibilitychange: ((this: Document, ev: Event) => any) | null; + readonly ownerDocument: null; + readonly pictureInPictureEnabled: boolean; + /** Return an HTMLCollection of the embed elements in the Document. */ + readonly plugins: HTMLCollectionOf; + /** Retrieves a value that indicates the current state of the object. */ + readonly readyState: DocumentReadyState; + /** Gets the URL of the location that referred the user to the current page. */ + readonly referrer: string; + /** @deprecated */ + readonly rootElement: SVGSVGElement | null; + /** Retrieves a collection of all script objects in the document. */ + readonly scripts: HTMLCollectionOf; + readonly scrollingElement: Element | null; + readonly timeline: DocumentTimeline; + /** Contains the title of the document. */ + title: string; + readonly visibilityState: VisibilityState; + /** + * Sets or gets the color of the links that the user has visited. + * @deprecated + */ + vlinkColor: string; + /** + * Moves node from another document and returns it. + * + * If node is a document, throws a "NotSupportedError" DOMException or, if node is a shadow root, throws a "HierarchyRequestError" DOMException. + */ + adoptNode(node: T): T; + /** @deprecated */ + captureEvents(): void; + /** @deprecated */ + caretRangeFromPoint(x: number, y: number): Range | null; + /** @deprecated */ + clear(): void; + /** Closes an output stream and forces the sent data to display. */ + close(): void; + /** + * Creates an attribute object with a specified name. + * @param name String that sets the attribute object's name. + */ + createAttribute(localName: string): Attr; + createAttributeNS(namespace: string | null, qualifiedName: string): Attr; + /** Returns a CDATASection node whose data is data. */ + createCDATASection(data: string): CDATASection; + /** + * Creates a comment object with the specified data. + * @param data Sets the comment object's data. + */ + createComment(data: string): Comment; + /** Creates a new document. */ + createDocumentFragment(): DocumentFragment; + /** + * Creates an instance of the element for the specified tag. + * @param tagName The name of an element. + */ + createElement(tagName: K, options?: ElementCreationOptions): HTMLElementTagNameMap[K]; + /** @deprecated */ + createElement(tagName: K, options?: ElementCreationOptions): HTMLElementDeprecatedTagNameMap[K]; + createElement(tagName: string, options?: ElementCreationOptions): HTMLElement; + /** + * Returns an element with namespace namespace. Its namespace prefix will be everything before ":" (U+003E) in qualifiedName or null. Its local name will be everything after ":" (U+003E) in qualifiedName or qualifiedName. + * + * If localName does not match the Name production an "InvalidCharacterError" DOMException will be thrown. + * + * If one of the following conditions is true a "NamespaceError" DOMException will be thrown: + * + * localName does not match the QName production. + * Namespace prefix is not null and namespace is the empty string. + * Namespace prefix is "xml" and namespace is not the XML namespace. + * qualifiedName or namespace prefix is "xmlns" and namespace is not the XMLNS namespace. + * namespace is the XMLNS namespace and neither qualifiedName nor namespace prefix is "xmlns". + * + * When supplied, options's is can be used to create a customized built-in element. + */ + createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement; + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: K): SVGElementTagNameMap[K]; + createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: string): SVGElement; + createElementNS(namespaceURI: string | null, qualifiedName: string, options?: ElementCreationOptions): Element; + createElementNS(namespace: string | null, qualifiedName: string, options?: string | ElementCreationOptions): Element; + createEvent(eventInterface: "AnimationEvent"): AnimationEvent; + createEvent(eventInterface: "AnimationPlaybackEvent"): AnimationPlaybackEvent; + createEvent(eventInterface: "AudioProcessingEvent"): AudioProcessingEvent; + createEvent(eventInterface: "BeforeUnloadEvent"): BeforeUnloadEvent; + createEvent(eventInterface: "BlobEvent"): BlobEvent; + createEvent(eventInterface: "ClipboardEvent"): ClipboardEvent; + createEvent(eventInterface: "CloseEvent"): CloseEvent; + createEvent(eventInterface: "CompositionEvent"): CompositionEvent; + createEvent(eventInterface: "CustomEvent"): CustomEvent; + createEvent(eventInterface: "DeviceMotionEvent"): DeviceMotionEvent; + createEvent(eventInterface: "DeviceOrientationEvent"): DeviceOrientationEvent; + createEvent(eventInterface: "DragEvent"): DragEvent; + createEvent(eventInterface: "ErrorEvent"): ErrorEvent; + createEvent(eventInterface: "FocusEvent"): FocusEvent; + createEvent(eventInterface: "FontFaceSetLoadEvent"): FontFaceSetLoadEvent; + createEvent(eventInterface: "FormDataEvent"): FormDataEvent; + createEvent(eventInterface: "GamepadEvent"): GamepadEvent; + createEvent(eventInterface: "HashChangeEvent"): HashChangeEvent; + createEvent(eventInterface: "IDBVersionChangeEvent"): IDBVersionChangeEvent; + createEvent(eventInterface: "InputEvent"): InputEvent; + createEvent(eventInterface: "KeyboardEvent"): KeyboardEvent; + createEvent(eventInterface: "MediaEncryptedEvent"): MediaEncryptedEvent; + createEvent(eventInterface: "MediaKeyMessageEvent"): MediaKeyMessageEvent; + createEvent(eventInterface: "MediaQueryListEvent"): MediaQueryListEvent; + createEvent(eventInterface: "MediaRecorderErrorEvent"): MediaRecorderErrorEvent; + createEvent(eventInterface: "MediaStreamTrackEvent"): MediaStreamTrackEvent; + createEvent(eventInterface: "MessageEvent"): MessageEvent; + createEvent(eventInterface: "MouseEvent"): MouseEvent; + createEvent(eventInterface: "MouseEvents"): MouseEvent; + createEvent(eventInterface: "MutationEvent"): MutationEvent; + createEvent(eventInterface: "MutationEvents"): MutationEvent; + createEvent(eventInterface: "OfflineAudioCompletionEvent"): OfflineAudioCompletionEvent; + createEvent(eventInterface: "PageTransitionEvent"): PageTransitionEvent; + createEvent(eventInterface: "PaymentMethodChangeEvent"): PaymentMethodChangeEvent; + createEvent(eventInterface: "PaymentRequestUpdateEvent"): PaymentRequestUpdateEvent; + createEvent(eventInterface: "PointerEvent"): PointerEvent; + createEvent(eventInterface: "PopStateEvent"): PopStateEvent; + createEvent(eventInterface: "ProgressEvent"): ProgressEvent; + createEvent(eventInterface: "PromiseRejectionEvent"): PromiseRejectionEvent; + createEvent(eventInterface: "RTCDTMFToneChangeEvent"): RTCDTMFToneChangeEvent; + createEvent(eventInterface: "RTCDataChannelEvent"): RTCDataChannelEvent; + createEvent(eventInterface: "RTCPeerConnectionIceErrorEvent"): RTCPeerConnectionIceErrorEvent; + createEvent(eventInterface: "RTCPeerConnectionIceEvent"): RTCPeerConnectionIceEvent; + createEvent(eventInterface: "RTCTrackEvent"): RTCTrackEvent; + createEvent(eventInterface: "SecurityPolicyViolationEvent"): SecurityPolicyViolationEvent; + createEvent(eventInterface: "SpeechSynthesisErrorEvent"): SpeechSynthesisErrorEvent; + createEvent(eventInterface: "SpeechSynthesisEvent"): SpeechSynthesisEvent; + createEvent(eventInterface: "StorageEvent"): StorageEvent; + createEvent(eventInterface: "SubmitEvent"): SubmitEvent; + createEvent(eventInterface: "TouchEvent"): TouchEvent; + createEvent(eventInterface: "TrackEvent"): TrackEvent; + createEvent(eventInterface: "TransitionEvent"): TransitionEvent; + createEvent(eventInterface: "UIEvent"): UIEvent; + createEvent(eventInterface: "UIEvents"): UIEvent; + createEvent(eventInterface: "WebGLContextEvent"): WebGLContextEvent; + createEvent(eventInterface: "WheelEvent"): WheelEvent; + createEvent(eventInterface: string): Event; + /** + * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document. + * @param root The root element or node to start traversing on. + * @param whatToShow The type of nodes or elements to appear in the node list + * @param filter A custom NodeFilter function to use. For more information, see filter. Use null for no filter. + */ + createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter | null): NodeIterator; + /** Returns a ProcessingInstruction node whose target is target and data is data. If target does not match the Name production an "InvalidCharacterError" DOMException will be thrown. If data contains "?>" an "InvalidCharacterError" DOMException will be thrown. */ + createProcessingInstruction(target: string, data: string): ProcessingInstruction; + /** Returns an empty range object that has both of its boundary points positioned at the beginning of the document. */ + createRange(): Range; + /** + * Creates a text string from the specified value. + * @param data String that specifies the nodeValue property of the text node. + */ + createTextNode(data: string): Text; + /** + * Creates a TreeWalker object that you can use to traverse filtered lists of nodes or elements in a document. + * @param root The root element or node to start traversing on. + * @param whatToShow The type of nodes or elements to appear in the node list. For more information, see whatToShow. + * @param filter A custom NodeFilter function to use. + */ + createTreeWalker(root: Node, whatToShow?: number, filter?: NodeFilter | null): TreeWalker; + /** + * Executes a command on the current document, current selection, or the given range. + * @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script. + * @param showUI Display the user interface, defaults to false. + * @param value Value to assign. + * @deprecated + */ + execCommand(commandId: string, showUI?: boolean, value?: string): boolean; + /** Stops document's fullscreen element from being displayed fullscreen and resolves promise when done. */ + exitFullscreen(): Promise; + exitPictureInPicture(): Promise; + exitPointerLock(): void; + /** + * Returns a reference to the first object with the specified value of the ID attribute. + * @param elementId String that specifies the ID value. + */ + getElementById(elementId: string): HTMLElement | null; + /** Returns a HTMLCollection of the elements in the object on which the method was invoked (a document or an element) that have all the classes given by classNames. The classNames argument is interpreted as a space-separated list of classes. */ + getElementsByClassName(classNames: string): HTMLCollectionOf; + /** + * Gets a collection of objects based on the value of the NAME or ID attribute. + * @param elementName Gets a collection of objects based on the value of the NAME or ID attribute. + */ + getElementsByName(elementName: string): NodeListOf; + /** + * Retrieves a collection of objects based on the specified element name. + * @param name Specifies the name of an element. + */ + getElementsByTagName(qualifiedName: K): HTMLCollectionOf; + getElementsByTagName(qualifiedName: K): HTMLCollectionOf; + getElementsByTagName(qualifiedName: string): HTMLCollectionOf; + /** + * If namespace and localName are "*" returns a HTMLCollection of all descendant elements. + * + * If only namespace is "*" returns a HTMLCollection of all descendant elements whose local name is localName. + * + * If only localName is "*" returns a HTMLCollection of all descendant elements whose namespace is namespace. + * + * Otherwise, returns a HTMLCollection of all descendant elements whose namespace is namespace and local name is localName. + */ + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespace: string | null, localName: string): HTMLCollectionOf; + /** Returns an object representing the current selection of the document that is loaded into the object displaying a webpage. */ + getSelection(): Selection | null; + /** Gets a value indicating whether the object currently has focus. */ + hasFocus(): boolean; + hasStorageAccess(): Promise; + /** + * Returns a copy of node. If deep is true, the copy also includes the node's descendants. + * + * If node is a document or a shadow root, throws a "NotSupportedError" DOMException. + */ + importNode(node: T, deep?: boolean): T; + /** + * Opens a new window and loads a document specified by a given URL. Also, opens a new window that uses the url parameter and the name parameter to collect the output of the write method and the writeln method. + * @param url Specifies a MIME type for the document. + * @param name Specifies the name of the window. This name is used as the value for the TARGET attribute on a form or an anchor element. + * @param features Contains a list of items separated by commas. Each item consists of an option and a value, separated by an equals sign (for example, "fullscreen=yes, toolbar=yes"). The following values are supported. + * @param replace Specifies whether the existing entry for the document is replaced in the history list. + */ + open(unused1?: string, unused2?: string): Document; + open(url: string | URL, name: string, features: string): WindowProxy | null; + /** + * Returns a Boolean value that indicates whether a specified command can be successfully executed using execCommand, given the current state of the document. + * @param commandId Specifies a command identifier. + * @deprecated + */ + queryCommandEnabled(commandId: string): boolean; + /** + * Returns a Boolean value that indicates whether the specified command is in the indeterminate state. + * @param commandId String that specifies a command identifier. + */ + queryCommandIndeterm(commandId: string): boolean; + /** + * Returns a Boolean value that indicates the current state of the command. + * @param commandId String that specifies a command identifier. + * @deprecated + */ + queryCommandState(commandId: string): boolean; + /** + * Returns a Boolean value that indicates whether the current command is supported on the current range. + * @param commandId Specifies a command identifier. + * @deprecated + */ + queryCommandSupported(commandId: string): boolean; + /** + * Returns the current value of the document, range, or current selection for the given command. + * @param commandId String that specifies a command identifier. + */ + queryCommandValue(commandId: string): string; + /** @deprecated */ + releaseEvents(): void; + requestStorageAccess(): Promise; + /** + * Writes one or more HTML expressions to a document in the specified window. + * @param content Specifies the text and HTML tags to write. + */ + write(...text: string[]): void; + /** + * Writes one or more HTML expressions, followed by a carriage return, to a document in the specified window. + * @param content The text and HTML tags to write. + */ + writeln(...text: string[]): void; + addEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: Document, ev: DocumentEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var Document: { + prototype: Document; + new(): Document; +}; + +interface DocumentAndElementEventHandlersEventMap { + "copy": ClipboardEvent; + "cut": ClipboardEvent; + "paste": ClipboardEvent; +} + +interface DocumentAndElementEventHandlers { + oncopy: ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | null; + oncut: ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | null; + onpaste: ((this: DocumentAndElementEventHandlers, ev: ClipboardEvent) => any) | null; + addEventListener(type: K, listener: (this: DocumentAndElementEventHandlers, ev: DocumentAndElementEventHandlersEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: DocumentAndElementEventHandlers, ev: DocumentAndElementEventHandlersEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +/** A minimal document object that has no parent. It is used as a lightweight version of Document that stores a segment of a document structure comprised of nodes just like a standard document. The key difference is that because the document fragment isn't part of the active document tree structure, changes made to the fragment don't affect the document, cause reflow, or incur any performance impact that can occur when changes are made. */ +interface DocumentFragment extends Node, NonElementParentNode, ParentNode { + readonly ownerDocument: Document; + getElementById(elementId: string): HTMLElement | null; +} + +declare var DocumentFragment: { + prototype: DocumentFragment; + new(): DocumentFragment; +}; + +interface DocumentOrShadowRoot { + /** + * Returns the deepest element in the document through which or to which key events are being routed. This is, roughly speaking, the focused element in the document. + * + * For the purposes of this API, when a child browsing context is focused, its container is focused in the parent browsing context. For example, if the user moves the focus to a text control in an iframe, the iframe is the element returned by the activeElement API in the iframe's node document. + * + * Similarly, when the focused element is in a different node tree than documentOrShadowRoot, the element returned will be the host that's located in the same node tree as documentOrShadowRoot if documentOrShadowRoot is a shadow-including inclusive ancestor of the focused element, and null if not. + */ + readonly activeElement: Element | null; + /** Returns document's fullscreen element. */ + readonly fullscreenElement: Element | null; + readonly pictureInPictureElement: Element | null; + readonly pointerLockElement: Element | null; + /** Retrieves a collection of styleSheet objects representing the style sheets that correspond to each instance of a link or style object in the document. */ + readonly styleSheets: StyleSheetList; + /** + * Returns the element for the specified x coordinate and the specified y coordinate. + * @param x The x-offset + * @param y The y-offset + */ + elementFromPoint(x: number, y: number): Element | null; + elementsFromPoint(x: number, y: number): Element[]; + getAnimations(): Animation[]; +} + +interface DocumentTimeline extends AnimationTimeline { +} + +declare var DocumentTimeline: { + prototype: DocumentTimeline; + new(options?: DocumentTimelineOptions): DocumentTimeline; +}; + +/** A Node containing a doctype. */ +interface DocumentType extends Node, ChildNode { + readonly name: string; + readonly ownerDocument: Document; + readonly publicId: string; + readonly systemId: string; +} + +declare var DocumentType: { + prototype: DocumentType; + new(): DocumentType; +}; + +/** A DOM event that represents a drag and drop interaction. The user initiates a drag by placing a pointer device (such as a mouse) on the touch surface and then dragging the pointer to a new location (such as another DOM element). Applications are free to interpret a drag and drop interaction in an application-specific way. */ +interface DragEvent extends MouseEvent { + /** Returns the DataTransfer object for the event. */ + readonly dataTransfer: DataTransfer | null; +} + +declare var DragEvent: { + prototype: DragEvent; + new(type: string, eventInitDict?: DragEventInit): DragEvent; +}; + +/** Inherits properties from its parent, AudioNode. */ +interface DynamicsCompressorNode extends AudioNode { + readonly attack: AudioParam; + readonly knee: AudioParam; + readonly ratio: AudioParam; + readonly reduction: number; + readonly release: AudioParam; + readonly threshold: AudioParam; +} + +declare var DynamicsCompressorNode: { + prototype: DynamicsCompressorNode; + new(context: BaseAudioContext, options?: DynamicsCompressorOptions): DynamicsCompressorNode; +}; + +interface EXT_blend_minmax { + readonly MAX_EXT: GLenum; + readonly MIN_EXT: GLenum; +} + +interface EXT_color_buffer_float { +} + +interface EXT_color_buffer_half_float { + readonly FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT: GLenum; + readonly RGB16F_EXT: GLenum; + readonly RGBA16F_EXT: GLenum; + readonly UNSIGNED_NORMALIZED_EXT: GLenum; +} + +interface EXT_float_blend { +} + +/** The EXT_frag_depth extension is part of the WebGL API and enables to set a depth value of a fragment from within the fragment shader. */ +interface EXT_frag_depth { +} + +interface EXT_sRGB { + readonly FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT: GLenum; + readonly SRGB8_ALPHA8_EXT: GLenum; + readonly SRGB_ALPHA_EXT: GLenum; + readonly SRGB_EXT: GLenum; +} + +interface EXT_shader_texture_lod { +} + +interface EXT_texture_compression_rgtc { + readonly COMPRESSED_RED_GREEN_RGTC2_EXT: GLenum; + readonly COMPRESSED_RED_RGTC1_EXT: GLenum; + readonly COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: GLenum; + readonly COMPRESSED_SIGNED_RED_RGTC1_EXT: GLenum; +} + +/** The EXT_texture_filter_anisotropic extension is part of the WebGL API and exposes two constants for anisotropic filtering (AF). */ +interface EXT_texture_filter_anisotropic { + readonly MAX_TEXTURE_MAX_ANISOTROPY_EXT: GLenum; + readonly TEXTURE_MAX_ANISOTROPY_EXT: GLenum; +} + +interface ElementEventMap { + "fullscreenchange": Event; + "fullscreenerror": Event; +} + +/** Element is the most general base class from which all objects in a Document inherit. It only has methods and properties common to all kinds of elements. More specific classes inherit from Element. */ +interface Element extends Node, ARIAMixin, Animatable, ChildNode, InnerHTML, NonDocumentTypeChildNode, ParentNode, Slottable { + readonly attributes: NamedNodeMap; + /** Allows for manipulation of element's class content attribute as a set of whitespace-separated tokens through a DOMTokenList object. */ + readonly classList: DOMTokenList; + /** Returns the value of element's class content attribute. Can be set to change it. */ + className: string; + readonly clientHeight: number; + readonly clientLeft: number; + readonly clientTop: number; + readonly clientWidth: number; + /** Returns the value of element's id content attribute. Can be set to change it. */ + id: string; + /** Returns the local name. */ + readonly localName: string; + /** Returns the namespace. */ + readonly namespaceURI: string | null; + onfullscreenchange: ((this: Element, ev: Event) => any) | null; + onfullscreenerror: ((this: Element, ev: Event) => any) | null; + outerHTML: string; + readonly ownerDocument: Document; + readonly part: DOMTokenList; + /** Returns the namespace prefix. */ + readonly prefix: string | null; + readonly scrollHeight: number; + scrollLeft: number; + scrollTop: number; + readonly scrollWidth: number; + /** Returns element's shadow root, if any, and if shadow root's mode is "open", and null otherwise. */ + readonly shadowRoot: ShadowRoot | null; + /** Returns the value of element's slot content attribute. Can be set to change it. */ + slot: string; + /** Returns the HTML-uppercased qualified name. */ + readonly tagName: string; + /** Creates a shadow root for element and returns it. */ + attachShadow(init: ShadowRootInit): ShadowRoot; + /** Returns the first (starting at element) inclusive ancestor that matches selectors, and null otherwise. */ + closest(selector: K): HTMLElementTagNameMap[K] | null; + closest(selector: K): SVGElementTagNameMap[K] | null; + closest(selectors: string): E | null; + /** Returns element's first attribute whose qualified name is qualifiedName, and null if there is no such attribute otherwise. */ + getAttribute(qualifiedName: string): string | null; + /** Returns element's attribute whose namespace is namespace and local name is localName, and null if there is no such attribute otherwise. */ + getAttributeNS(namespace: string | null, localName: string): string | null; + /** Returns the qualified names of all element's attributes. Can contain duplicates. */ + getAttributeNames(): string[]; + getAttributeNode(qualifiedName: string): Attr | null; + getAttributeNodeNS(namespace: string | null, localName: string): Attr | null; + getBoundingClientRect(): DOMRect; + getClientRects(): DOMRectList; + /** Returns a HTMLCollection of the elements in the object on which the method was invoked (a document or an element) that have all the classes given by classNames. The classNames argument is interpreted as a space-separated list of classes. */ + getElementsByClassName(classNames: string): HTMLCollectionOf; + getElementsByTagName(qualifiedName: K): HTMLCollectionOf; + getElementsByTagName(qualifiedName: K): HTMLCollectionOf; + getElementsByTagName(qualifiedName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/1999/xhtml", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespaceURI: "http://www.w3.org/2000/svg", localName: string): HTMLCollectionOf; + getElementsByTagNameNS(namespace: string | null, localName: string): HTMLCollectionOf; + /** Returns true if element has an attribute whose qualified name is qualifiedName, and false otherwise. */ + hasAttribute(qualifiedName: string): boolean; + /** Returns true if element has an attribute whose namespace is namespace and local name is localName. */ + hasAttributeNS(namespace: string | null, localName: string): boolean; + /** Returns true if element has attributes, and false otherwise. */ + hasAttributes(): boolean; + hasPointerCapture(pointerId: number): boolean; + insertAdjacentElement(where: InsertPosition, element: Element): Element | null; + insertAdjacentHTML(position: InsertPosition, text: string): void; + insertAdjacentText(where: InsertPosition, data: string): void; + /** Returns true if matching selectors against element's root yields element, and false otherwise. */ + matches(selectors: string): boolean; + releasePointerCapture(pointerId: number): void; + /** Removes element's first attribute whose qualified name is qualifiedName. */ + removeAttribute(qualifiedName: string): void; + /** Removes element's attribute whose namespace is namespace and local name is localName. */ + removeAttributeNS(namespace: string | null, localName: string): void; + removeAttributeNode(attr: Attr): Attr; + /** + * Displays element fullscreen and resolves promise when done. + * + * When supplied, options's navigationUI member indicates whether showing navigation UI while in fullscreen is preferred or not. If set to "show", navigation simplicity is preferred over screen space, and if set to "hide", more screen space is preferred. User agents are always free to honor user preference over the application's. The default value "auto" indicates no application preference. + */ + requestFullscreen(options?: FullscreenOptions): Promise; + requestPointerLock(): void; + scroll(options?: ScrollToOptions): void; + scroll(x: number, y: number): void; + scrollBy(options?: ScrollToOptions): void; + scrollBy(x: number, y: number): void; + scrollIntoView(arg?: boolean | ScrollIntoViewOptions): void; + scrollTo(options?: ScrollToOptions): void; + scrollTo(x: number, y: number): void; + /** Sets the value of element's first attribute whose qualified name is qualifiedName to value. */ + setAttribute(qualifiedName: string, value: string): void; + /** Sets the value of element's attribute whose namespace is namespace and local name is localName to value. */ + setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void; + setAttributeNode(attr: Attr): Attr | null; + setAttributeNodeNS(attr: Attr): Attr | null; + setPointerCapture(pointerId: number): void; + /** + * If force is not given, "toggles" qualifiedName, removing it if it is present and adding it if it is not present. If force is true, adds qualifiedName. If force is false, removes qualifiedName. + * + * Returns true if qualifiedName is now present, and false otherwise. + */ + toggleAttribute(qualifiedName: string, force?: boolean): boolean; + /** @deprecated This is a legacy alias of `matches`. */ + webkitMatchesSelector(selectors: string): boolean; + addEventListener(type: K, listener: (this: Element, ev: ElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: Element, ev: ElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var Element: { + prototype: Element; + new(): Element; +}; + +interface ElementCSSInlineStyle { + readonly style: CSSStyleDeclaration; +} + +interface ElementContentEditable { + contentEditable: string; + enterKeyHint: string; + inputMode: string; + readonly isContentEditable: boolean; +} + +interface ElementInternals extends ARIAMixin { + /** Returns the ShadowRoot for internals's target element, if the target element is a shadow host, or null otherwise. */ + readonly shadowRoot: ShadowRoot | null; +} + +declare var ElementInternals: { + prototype: ElementInternals; + new(): ElementInternals; +}; + +/** Events providing information related to errors in scripts or in files. */ +interface ErrorEvent extends Event { + readonly colno: number; + readonly error: any; + readonly filename: string; + readonly lineno: number; + readonly message: string; +} + +declare var ErrorEvent: { + prototype: ErrorEvent; + new(type: string, eventInitDict?: ErrorEventInit): ErrorEvent; +}; + +/** An event which takes place in the DOM. */ +interface Event { + /** Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise. */ + readonly bubbles: boolean; + cancelBubble: boolean; + /** Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. */ + readonly cancelable: boolean; + /** Returns true or false depending on how event was initialized. True if event invokes listeners past a ShadowRoot node that is the root of its target, and false otherwise. */ + readonly composed: boolean; + /** Returns the object whose event listener's callback is currently being invoked. */ + readonly currentTarget: EventTarget | null; + /** Returns true if preventDefault() was invoked successfully to indicate cancelation, and false otherwise. */ + readonly defaultPrevented: boolean; + /** Returns the event's phase, which is one of NONE, CAPTURING_PHASE, AT_TARGET, and BUBBLING_PHASE. */ + readonly eventPhase: number; + /** Returns true if event was dispatched by the user agent, and false otherwise. */ + readonly isTrusted: boolean; + /** @deprecated */ + returnValue: boolean; + /** @deprecated */ + readonly srcElement: EventTarget | null; + /** Returns the object to which event is dispatched (its target). */ + readonly target: EventTarget | null; + /** Returns the event's timestamp as the number of milliseconds measured relative to the time origin. */ + readonly timeStamp: DOMHighResTimeStamp; + /** Returns the type of event, e.g. "click", "hashchange", or "submit". */ + readonly type: string; + /** Returns the invocation target objects of event's path (objects on which listeners will be invoked), except for any nodes in shadow trees of which the shadow root's mode is "closed" that are not reachable from event's currentTarget. */ + composedPath(): EventTarget[]; + /** @deprecated */ + initEvent(type: string, bubbles?: boolean, cancelable?: boolean): void; + /** If invoked when the cancelable attribute value is true, and while executing a listener for the event with passive set to false, signals to the operation that caused event to be dispatched that it needs to be canceled. */ + preventDefault(): void; + /** Invoking this method prevents event from reaching any registered event listeners after the current one finishes running and, when dispatched in a tree, also prevents event from reaching any other objects. */ + stopImmediatePropagation(): void; + /** When dispatched in a tree, invoking this method prevents event from reaching any objects other than the current object. */ + stopPropagation(): void; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; + readonly NONE: number; +} + +declare var Event: { + prototype: Event; + new(type: string, eventInitDict?: EventInit): Event; + readonly AT_TARGET: number; + readonly BUBBLING_PHASE: number; + readonly CAPTURING_PHASE: number; + readonly NONE: number; +}; + +interface EventListener { + (evt: Event): void; +} + +interface EventListenerObject { + handleEvent(object: Event): void; +} + +interface EventSourceEventMap { + "error": Event; + "message": MessageEvent; + "open": Event; +} + +interface EventSource extends EventTarget { + onerror: ((this: EventSource, ev: Event) => any) | null; + onmessage: ((this: EventSource, ev: MessageEvent) => any) | null; + onopen: ((this: EventSource, ev: Event) => any) | null; + /** Returns the state of this EventSource object's connection. It can have the values described below. */ + readonly readyState: number; + /** Returns the URL providing the event stream. */ + readonly url: string; + /** Returns true if the credentials mode for connection requests to the URL providing the event stream is set to "include", and false otherwise. */ + readonly withCredentials: boolean; + /** Aborts any instances of the fetch algorithm started for this EventSource object, and sets the readyState attribute to CLOSED. */ + close(): void; + readonly CLOSED: number; + readonly CONNECTING: number; + readonly OPEN: number; + addEventListener(type: K, listener: (this: EventSource, ev: EventSourceEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: EventSource, ev: EventSourceEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var EventSource: { + prototype: EventSource; + new(url: string | URL, eventSourceInitDict?: EventSourceInit): EventSource; + readonly CLOSED: number; + readonly CONNECTING: number; + readonly OPEN: number; +}; + +/** EventTarget is a DOM interface implemented by objects that can receive events and may have listeners for them. */ +interface EventTarget { + /** + * Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched. + * + * The options argument sets listener-specific options. For compatibility this can be a boolean, in which case the method behaves exactly as if the value was specified as options's capture. + * + * When set to true, options's capture prevents callback from being invoked when the event's eventPhase attribute value is BUBBLING_PHASE. When false (or not present), callback will not be invoked when event's eventPhase attribute value is CAPTURING_PHASE. Either way, callback will be invoked if event's eventPhase attribute value is AT_TARGET. + * + * When set to true, options's passive indicates that the callback will not cancel the event by invoking preventDefault(). This is used to enable performance optimizations described in § 2.8 Observing event listeners. + * + * When set to true, options's once indicates that the callback will only be invoked once after which the event listener will be removed. + * + * If an AbortSignal is passed for options's signal, then the event listener will be removed when signal is aborted. + * + * The event listener is appended to target's event listener list and is not appended if it has the same type, callback, and capture. + */ + addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean): void; + /** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */ + dispatchEvent(event: Event): boolean; + /** Removes the event listener in target's event listener list with the same type, callback, and options. */ + removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void; +} + +declare var EventTarget: { + prototype: EventTarget; + new(): EventTarget; +}; + +/** @deprecated */ +interface External { + /** @deprecated */ + AddSearchProvider(): void; + /** @deprecated */ + IsSearchProviderInstalled(): void; +} + +/** @deprecated */ +declare var External: { + prototype: External; + new(): External; +}; + +/** Provides information about files and allows JavaScript in a web page to access their content. */ +interface File extends Blob { + readonly lastModified: number; + readonly name: string; + readonly webkitRelativePath: string; +} + +declare var File: { + prototype: File; + new(fileBits: BlobPart[], fileName: string, options?: FilePropertyBag): File; +}; + +/** An object of this type is returned by the files property of the HTML element; this lets you access the list of files selected with the element. It's also used for a list of files dropped into web content when using the drag and drop API; see the DataTransfer object for details on this usage. */ +interface FileList { + readonly length: number; + item(index: number): File | null; + [index: number]: File; +} + +declare var FileList: { + prototype: FileList; + new(): FileList; +}; + +interface FileReaderEventMap { + "abort": ProgressEvent; + "error": ProgressEvent; + "load": ProgressEvent; + "loadend": ProgressEvent; + "loadstart": ProgressEvent; + "progress": ProgressEvent; +} + +/** Lets web applications asynchronously read the contents of files (or raw data buffers) stored on the user's computer, using File or Blob objects to specify the file or data to read. */ +interface FileReader extends EventTarget { + readonly error: DOMException | null; + onabort: ((this: FileReader, ev: ProgressEvent) => any) | null; + onerror: ((this: FileReader, ev: ProgressEvent) => any) | null; + onload: ((this: FileReader, ev: ProgressEvent) => any) | null; + onloadend: ((this: FileReader, ev: ProgressEvent) => any) | null; + onloadstart: ((this: FileReader, ev: ProgressEvent) => any) | null; + onprogress: ((this: FileReader, ev: ProgressEvent) => any) | null; + readonly readyState: number; + readonly result: string | ArrayBuffer | null; + abort(): void; + readAsArrayBuffer(blob: Blob): void; + readAsBinaryString(blob: Blob): void; + readAsDataURL(blob: Blob): void; + readAsText(blob: Blob, encoding?: string): void; + readonly DONE: number; + readonly EMPTY: number; + readonly LOADING: number; + addEventListener(type: K, listener: (this: FileReader, ev: FileReaderEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: FileReader, ev: FileReaderEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var FileReader: { + prototype: FileReader; + new(): FileReader; + readonly DONE: number; + readonly EMPTY: number; + readonly LOADING: number; +}; + +interface FileSystem { + readonly name: string; + readonly root: FileSystemDirectoryEntry; +} + +declare var FileSystem: { + prototype: FileSystem; + new(): FileSystem; +}; + +interface FileSystemDirectoryEntry extends FileSystemEntry { + createReader(): FileSystemDirectoryReader; + getDirectory(path?: string | null, options?: FileSystemFlags, successCallback?: FileSystemEntryCallback, errorCallback?: ErrorCallback): void; + getFile(path?: string | null, options?: FileSystemFlags, successCallback?: FileSystemEntryCallback, errorCallback?: ErrorCallback): void; +} + +declare var FileSystemDirectoryEntry: { + prototype: FileSystemDirectoryEntry; + new(): FileSystemDirectoryEntry; +}; + +interface FileSystemDirectoryReader { + readEntries(successCallback: FileSystemEntriesCallback, errorCallback?: ErrorCallback): void; +} + +declare var FileSystemDirectoryReader: { + prototype: FileSystemDirectoryReader; + new(): FileSystemDirectoryReader; +}; + +interface FileSystemEntry { + readonly filesystem: FileSystem; + readonly fullPath: string; + readonly isDirectory: boolean; + readonly isFile: boolean; + readonly name: string; + getParent(successCallback?: FileSystemEntryCallback, errorCallback?: ErrorCallback): void; +} + +declare var FileSystemEntry: { + prototype: FileSystemEntry; + new(): FileSystemEntry; +}; + +interface FileSystemFileEntry extends FileSystemEntry { + file(successCallback: FileCallback, errorCallback?: ErrorCallback): void; +} + +declare var FileSystemFileEntry: { + prototype: FileSystemFileEntry; + new(): FileSystemFileEntry; +}; + +/** Focus-related events like focus, blur, focusin, or focusout. */ +interface FocusEvent extends UIEvent { + readonly relatedTarget: EventTarget | null; +} + +declare var FocusEvent: { + prototype: FocusEvent; + new(type: string, eventInitDict?: FocusEventInit): FocusEvent; +}; + +interface FontFace { + ascentOverride: string; + descentOverride: string; + display: string; + family: string; + featureSettings: string; + lineGapOverride: string; + readonly loaded: Promise; + readonly status: FontFaceLoadStatus; + stretch: string; + style: string; + unicodeRange: string; + variant: string; + variationSettings: string; + weight: string; + load(): Promise; +} + +declare var FontFace: { + prototype: FontFace; + new(family: string, source: string | BinaryData, descriptors?: FontFaceDescriptors): FontFace; +}; + +interface FontFaceSetEventMap { + "loading": Event; + "loadingdone": Event; + "loadingerror": Event; +} + +interface FontFaceSet extends EventTarget { + onloading: ((this: FontFaceSet, ev: Event) => any) | null; + onloadingdone: ((this: FontFaceSet, ev: Event) => any) | null; + onloadingerror: ((this: FontFaceSet, ev: Event) => any) | null; + readonly ready: Promise; + readonly status: FontFaceSetLoadStatus; + check(font: string, text?: string): boolean; + load(font: string, text?: string): Promise; + forEach(callbackfn: (value: FontFace, key: FontFace, parent: FontFaceSet) => void, thisArg?: any): void; + addEventListener(type: K, listener: (this: FontFaceSet, ev: FontFaceSetEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: FontFaceSet, ev: FontFaceSetEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var FontFaceSet: { + prototype: FontFaceSet; + new(initialFaces: FontFace[]): FontFaceSet; +}; + +interface FontFaceSetLoadEvent extends Event { + readonly fontfaces: ReadonlyArray; +} + +declare var FontFaceSetLoadEvent: { + prototype: FontFaceSetLoadEvent; + new(type: string, eventInitDict?: FontFaceSetLoadEventInit): FontFaceSetLoadEvent; +}; + +interface FontFaceSource { + readonly fonts: FontFaceSet; +} + +/** Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest.send() method. It uses the same format a form would use if the encoding type were set to "multipart/form-data". */ +interface FormData { + append(name: string, value: string | Blob, fileName?: string): void; + delete(name: string): void; + get(name: string): FormDataEntryValue | null; + getAll(name: string): FormDataEntryValue[]; + has(name: string): boolean; + set(name: string, value: string | Blob, fileName?: string): void; + forEach(callbackfn: (value: FormDataEntryValue, key: string, parent: FormData) => void, thisArg?: any): void; +} + +declare var FormData: { + prototype: FormData; + new(form?: HTMLFormElement): FormData; +}; + +interface FormDataEvent extends Event { + /** Returns a FormData object representing names and values of elements associated to the target form. Operations on the FormData object will affect form data to be submitted. */ + readonly formData: FormData; +} + +declare var FormDataEvent: { + prototype: FormDataEvent; + new(type: string, eventInitDict: FormDataEventInit): FormDataEvent; +}; + +/** A change in volume. It is an AudioNode audio-processing module that causes a given gain to be applied to the input data before its propagation to the output. A GainNode always has exactly one input and one output, both with the same number of channels. */ +interface GainNode extends AudioNode { + readonly gain: AudioParam; +} + +declare var GainNode: { + prototype: GainNode; + new(context: BaseAudioContext, options?: GainOptions): GainNode; +}; + +/** + * This Gamepad API interface defines an individual gamepad or other controller, allowing access to information such as button presses, axis positions, and id. + * Available only in secure contexts. + */ +interface Gamepad { + readonly axes: ReadonlyArray; + readonly buttons: ReadonlyArray; + readonly connected: boolean; + readonly hapticActuators: ReadonlyArray; + readonly id: string; + readonly index: number; + readonly mapping: GamepadMappingType; + readonly timestamp: DOMHighResTimeStamp; +} + +declare var Gamepad: { + prototype: Gamepad; + new(): Gamepad; +}; + +/** + * An individual button of a gamepad or other controller, allowing access to the current state of different types of buttons available on the control device. + * Available only in secure contexts. + */ +interface GamepadButton { + readonly pressed: boolean; + readonly touched: boolean; + readonly value: number; +} + +declare var GamepadButton: { + prototype: GamepadButton; + new(): GamepadButton; +}; + +/** + * This Gamepad API interface contains references to gamepads connected to the system, which is what the gamepad events Window.gamepadconnected and Window.gamepaddisconnected are fired in response to. + * Available only in secure contexts. + */ +interface GamepadEvent extends Event { + readonly gamepad: Gamepad; +} + +declare var GamepadEvent: { + prototype: GamepadEvent; + new(type: string, eventInitDict: GamepadEventInit): GamepadEvent; +}; + +/** This Gamepad API interface represents hardware in the controller designed to provide haptic feedback to the user (if available), most commonly vibration hardware. */ +interface GamepadHapticActuator { + readonly type: GamepadHapticActuatorType; +} + +declare var GamepadHapticActuator: { + prototype: GamepadHapticActuator; + new(): GamepadHapticActuator; +}; + +interface GenericTransformStream { + readonly readable: ReadableStream; + readonly writable: WritableStream; +} + +/** An object able to programmatically obtain the position of the device. It gives Web content access to the location of the device. This allows a Web site or app to offer customized results based on the user's location. */ +interface Geolocation { + clearWatch(watchId: number): void; + getCurrentPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback | null, options?: PositionOptions): void; + watchPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback | null, options?: PositionOptions): number; +} + +declare var Geolocation: { + prototype: Geolocation; + new(): Geolocation; +}; + +/** Available only in secure contexts. */ +interface GeolocationCoordinates { + readonly accuracy: number; + readonly altitude: number | null; + readonly altitudeAccuracy: number | null; + readonly heading: number | null; + readonly latitude: number; + readonly longitude: number; + readonly speed: number | null; +} + +declare var GeolocationCoordinates: { + prototype: GeolocationCoordinates; + new(): GeolocationCoordinates; +}; + +/** Available only in secure contexts. */ +interface GeolocationPosition { + readonly coords: GeolocationCoordinates; + readonly timestamp: DOMTimeStamp; +} + +declare var GeolocationPosition: { + prototype: GeolocationPosition; + new(): GeolocationPosition; +}; + +interface GeolocationPositionError { + readonly code: number; + readonly message: string; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; +} + +declare var GeolocationPositionError: { + prototype: GeolocationPositionError; + new(): GeolocationPositionError; + readonly PERMISSION_DENIED: number; + readonly POSITION_UNAVAILABLE: number; + readonly TIMEOUT: number; +}; + +interface GlobalEventHandlersEventMap { + "abort": UIEvent; + "animationcancel": AnimationEvent; + "animationend": AnimationEvent; + "animationiteration": AnimationEvent; + "animationstart": AnimationEvent; + "auxclick": MouseEvent; + "beforeinput": InputEvent; + "blur": FocusEvent; + "canplay": Event; + "canplaythrough": Event; + "change": Event; + "click": MouseEvent; + "close": Event; + "compositionend": CompositionEvent; + "compositionstart": CompositionEvent; + "compositionupdate": CompositionEvent; + "contextmenu": MouseEvent; + "cuechange": Event; + "dblclick": MouseEvent; + "drag": DragEvent; + "dragend": DragEvent; + "dragenter": DragEvent; + "dragleave": DragEvent; + "dragover": DragEvent; + "dragstart": DragEvent; + "drop": DragEvent; + "durationchange": Event; + "emptied": Event; + "ended": Event; + "error": ErrorEvent; + "focus": FocusEvent; + "focusin": FocusEvent; + "focusout": FocusEvent; + "formdata": FormDataEvent; + "gotpointercapture": PointerEvent; + "input": Event; + "invalid": Event; + "keydown": KeyboardEvent; + "keypress": KeyboardEvent; + "keyup": KeyboardEvent; + "load": Event; + "loadeddata": Event; + "loadedmetadata": Event; + "loadstart": Event; + "lostpointercapture": PointerEvent; + "mousedown": MouseEvent; + "mouseenter": MouseEvent; + "mouseleave": MouseEvent; + "mousemove": MouseEvent; + "mouseout": MouseEvent; + "mouseover": MouseEvent; + "mouseup": MouseEvent; + "pause": Event; + "play": Event; + "playing": Event; + "pointercancel": PointerEvent; + "pointerdown": PointerEvent; + "pointerenter": PointerEvent; + "pointerleave": PointerEvent; + "pointermove": PointerEvent; + "pointerout": PointerEvent; + "pointerover": PointerEvent; + "pointerup": PointerEvent; + "progress": ProgressEvent; + "ratechange": Event; + "reset": Event; + "resize": UIEvent; + "scroll": Event; + "securitypolicyviolation": SecurityPolicyViolationEvent; + "seeked": Event; + "seeking": Event; + "select": Event; + "selectionchange": Event; + "selectstart": Event; + "stalled": Event; + "submit": SubmitEvent; + "suspend": Event; + "timeupdate": Event; + "toggle": Event; + "touchcancel": TouchEvent; + "touchend": TouchEvent; + "touchmove": TouchEvent; + "touchstart": TouchEvent; + "transitioncancel": TransitionEvent; + "transitionend": TransitionEvent; + "transitionrun": TransitionEvent; + "transitionstart": TransitionEvent; + "volumechange": Event; + "waiting": Event; + "webkitanimationend": Event; + "webkitanimationiteration": Event; + "webkitanimationstart": Event; + "webkittransitionend": Event; + "wheel": WheelEvent; +} + +interface GlobalEventHandlers { + /** + * Fires when the user aborts the download. + * @param ev The event. + */ + onabort: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null; + onanimationcancel: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null; + onanimationend: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null; + onanimationiteration: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null; + onanimationstart: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null; + onauxclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; + /** + * Fires when the object loses the input focus. + * @param ev The focus event. + */ + onblur: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null; + /** + * Occurs when playback is possible, but would require further buffering. + * @param ev The event. + */ + oncanplay: ((this: GlobalEventHandlers, ev: Event) => any) | null; + oncanplaythrough: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** + * Fires when the contents of the object or selection have changed. + * @param ev The event. + */ + onchange: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** + * Fires when the user clicks the left mouse button on the object + * @param ev The mouse event. + */ + onclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; + onclose: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** + * Fires when the user clicks the right mouse button in the client area, opening the context menu. + * @param ev The mouse event. + */ + oncontextmenu: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; + oncuechange: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** + * Fires when the user double-clicks the object. + * @param ev The mouse event. + */ + ondblclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; + /** + * Fires on the source object continuously during a drag operation. + * @param ev The event. + */ + ondrag: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; + /** + * Fires on the source object when the user releases the mouse at the close of a drag operation. + * @param ev The event. + */ + ondragend: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; + /** + * Fires on the target element when the user drags the object to a valid drop target. + * @param ev The drag event. + */ + ondragenter: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; + /** + * Fires on the target object when the user moves the mouse out of a valid drop target during a drag operation. + * @param ev The drag event. + */ + ondragleave: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; + /** + * Fires on the target element continuously while the user drags the object over a valid drop target. + * @param ev The event. + */ + ondragover: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; + /** + * Fires on the source object when the user starts to drag a text selection or selected object. + * @param ev The event. + */ + ondragstart: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; + ondrop: ((this: GlobalEventHandlers, ev: DragEvent) => any) | null; + /** + * Occurs when the duration attribute is updated. + * @param ev The event. + */ + ondurationchange: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** + * Occurs when the media element is reset to its initial state. + * @param ev The event. + */ + onemptied: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** + * Occurs when the end of playback is reached. + * @param ev The event + */ + onended: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** + * Fires when an error occurs during object loading. + * @param ev The event. + */ + onerror: OnErrorEventHandler; + /** + * Fires when the object receives focus. + * @param ev The event. + */ + onfocus: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null; + onformdata: ((this: GlobalEventHandlers, ev: FormDataEvent) => any) | null; + ongotpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; + oninput: ((this: GlobalEventHandlers, ev: Event) => any) | null; + oninvalid: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** + * Fires when the user presses a key. + * @param ev The keyboard event + */ + onkeydown: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null; + /** + * Fires when the user presses an alphanumeric key. + * @param ev The event. + * @deprecated + */ + onkeypress: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null; + /** + * Fires when the user releases a key. + * @param ev The keyboard event + */ + onkeyup: ((this: GlobalEventHandlers, ev: KeyboardEvent) => any) | null; + /** + * Fires immediately after the browser loads the object. + * @param ev The event. + */ + onload: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** + * Occurs when media data is loaded at the current playback position. + * @param ev The event. + */ + onloadeddata: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** + * Occurs when the duration and dimensions of the media have been determined. + * @param ev The event. + */ + onloadedmetadata: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** + * Occurs when Internet Explorer begins looking for media data. + * @param ev The event. + */ + onloadstart: ((this: GlobalEventHandlers, ev: Event) => any) | null; + onlostpointercapture: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; + /** + * Fires when the user clicks the object with either mouse button. + * @param ev The mouse event. + */ + onmousedown: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; + onmouseenter: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; + onmouseleave: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; + /** + * Fires when the user moves the mouse over the object. + * @param ev The mouse event. + */ + onmousemove: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; + /** + * Fires when the user moves the mouse pointer outside the boundaries of the object. + * @param ev The mouse event. + */ + onmouseout: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; + /** + * Fires when the user moves the mouse pointer into the object. + * @param ev The mouse event. + */ + onmouseover: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; + /** + * Fires when the user releases a mouse button while the mouse is over the object. + * @param ev The mouse event. + */ + onmouseup: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; + /** + * Occurs when playback is paused. + * @param ev The event. + */ + onpause: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** + * Occurs when the play method is requested. + * @param ev The event. + */ + onplay: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** + * Occurs when the audio or video has started playing. + * @param ev The event. + */ + onplaying: ((this: GlobalEventHandlers, ev: Event) => any) | null; + onpointercancel: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; + onpointerdown: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; + onpointerenter: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; + onpointerleave: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; + onpointermove: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; + onpointerout: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; + onpointerover: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; + onpointerup: ((this: GlobalEventHandlers, ev: PointerEvent) => any) | null; + /** + * Occurs to indicate progress while downloading media data. + * @param ev The event. + */ + onprogress: ((this: GlobalEventHandlers, ev: ProgressEvent) => any) | null; + /** + * Occurs when the playback rate is increased or decreased. + * @param ev The event. + */ + onratechange: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** + * Fires when the user resets a form. + * @param ev The event. + */ + onreset: ((this: GlobalEventHandlers, ev: Event) => any) | null; + onresize: ((this: GlobalEventHandlers, ev: UIEvent) => any) | null; + /** + * Fires when the user repositions the scroll box in the scroll bar on the object. + * @param ev The event. + */ + onscroll: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** + * Occurs when the seek operation ends. + * @param ev The event. + */ + onseeked: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** + * Occurs when the current playback position is moved. + * @param ev The event. + */ + onseeking: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** + * Fires when the current selection changes. + * @param ev The event. + */ + onselect: ((this: GlobalEventHandlers, ev: Event) => any) | null; + onselectionchange: ((this: GlobalEventHandlers, ev: Event) => any) | null; + onselectstart: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** + * Occurs when the download has stopped. + * @param ev The event. + */ + onstalled: ((this: GlobalEventHandlers, ev: Event) => any) | null; + onsubmit: ((this: GlobalEventHandlers, ev: SubmitEvent) => any) | null; + /** + * Occurs if the load operation has been intentionally halted. + * @param ev The event. + */ + onsuspend: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** + * Occurs to indicate the current playback position. + * @param ev The event. + */ + ontimeupdate: ((this: GlobalEventHandlers, ev: Event) => any) | null; + ontoggle: ((this: GlobalEventHandlers, ev: Event) => any) | null; + ontouchcancel?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined; + ontouchend?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined; + ontouchmove?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined; + ontouchstart?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined; + ontransitioncancel: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null; + ontransitionend: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null; + ontransitionrun: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null; + ontransitionstart: ((this: GlobalEventHandlers, ev: TransitionEvent) => any) | null; + /** + * Occurs when the volume is changed, or playback is muted or unmuted. + * @param ev The event. + */ + onvolumechange: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** + * Occurs when playback stops because the next frame of a video resource is not available. + * @param ev The event. + */ + onwaiting: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** @deprecated This is a legacy alias of `onanimationend`. */ + onwebkitanimationend: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** @deprecated This is a legacy alias of `onanimationiteration`. */ + onwebkitanimationiteration: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** @deprecated This is a legacy alias of `onanimationstart`. */ + onwebkitanimationstart: ((this: GlobalEventHandlers, ev: Event) => any) | null; + /** @deprecated This is a legacy alias of `ontransitionend`. */ + onwebkittransitionend: ((this: GlobalEventHandlers, ev: Event) => any) | null; + onwheel: ((this: GlobalEventHandlers, ev: WheelEvent) => any) | null; + addEventListener(type: K, listener: (this: GlobalEventHandlers, ev: GlobalEventHandlersEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: GlobalEventHandlers, ev: GlobalEventHandlersEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +interface HTMLAllCollection { + /** Returns the number of elements in the collection. */ + readonly length: number; + /** Returns the item with index index from the collection (determined by tree order). */ + item(nameOrIndex?: string): HTMLCollection | Element | null; + /** + * Returns the item with ID or name name from the collection. + * + * If there are multiple matching items, then an HTMLCollection object containing all those elements is returned. + * + * Only button, form, iframe, input, map, meta, object, select, and textarea elements can have a name for the purpose of this method; their name is given by the value of their name attribute. + */ + namedItem(name: string): HTMLCollection | Element | null; + [index: number]: Element; +} + +declare var HTMLAllCollection: { + prototype: HTMLAllCollection; + new(): HTMLAllCollection; +}; + +/** Hyperlink elements and provides special properties and methods (beyond those of the regular HTMLElement object interface that they inherit from) for manipulating the layout and presentation of such elements. */ +interface HTMLAnchorElement extends HTMLElement, HTMLHyperlinkElementUtils { + /** + * Sets or retrieves the character set used to encode the object. + * @deprecated + */ + charset: string; + /** + * Sets or retrieves the coordinates of the object. + * @deprecated + */ + coords: string; + download: string; + /** Sets or retrieves the language code of the object. */ + hreflang: string; + /** + * Sets or retrieves the shape of the object. + * @deprecated + */ + name: string; + ping: string; + referrerPolicy: string; + /** Sets or retrieves the relationship between the object and the destination of the link. */ + rel: string; + readonly relList: DOMTokenList; + /** + * Sets or retrieves the relationship between the object and the destination of the link. + * @deprecated + */ + rev: string; + /** + * Sets or retrieves the shape of the object. + * @deprecated + */ + shape: string; + /** Sets or retrieves the window or frame at which to target content. */ + target: string; + /** Retrieves or sets the text of the object as a string. */ + text: string; + type: string; + addEventListener(type: K, listener: (this: HTMLAnchorElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: HTMLAnchorElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var HTMLAnchorElement: { + prototype: HTMLAnchorElement; + new(): HTMLAnchorElement; +}; + +/** Provides special properties and methods (beyond those of the regular object HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of elements. */ +interface HTMLAreaElement extends HTMLElement, HTMLHyperlinkElementUtils { + /** Sets or retrieves a text alternative to the graphic. */ + alt: string; + /** Sets or retrieves the coordinates of the object. */ + coords: string; + download: string; + /** + * Sets or gets whether clicks in this region cause action. + * @deprecated + */ + noHref: boolean; + ping: string; + referrerPolicy: string; + rel: string; + readonly relList: DOMTokenList; + /** Sets or retrieves the shape of the object. */ + shape: string; + /** Sets or retrieves the window or frame at which to target content. */ + target: string; + addEventListener(type: K, listener: (this: HTMLAreaElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: HTMLAreaElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var HTMLAreaElement: { + prototype: HTMLAreaElement; + new(): HTMLAreaElement; +}; + +/** Provides access to the properties of