mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-11-29 09:41:45 +00:00
Merge pull request #1 from DefinitelyTyped/master
sync from origin DefinitelyTyped
This commit is contained in:
+307
-133
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,7 @@
|
||||
|
||||
Also see the [definitelytyped.org](http://definitelytyped.org) website, although information in this README is more up-to-date.
|
||||
|
||||
*You can also read this README in [Spanish](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.es.md) and [Korean!](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.ko.md)*
|
||||
*You can also read this README in [Spanish](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.es.md), [Korean](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.ko.md), and [Russian](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.ru.md)!*
|
||||
|
||||
## What are declaration files?
|
||||
|
||||
@@ -169,8 +169,14 @@ If a package was never on DefinitelyTyped, it does not need to be added to `notN
|
||||
|
||||
#### Lint
|
||||
|
||||
To lint a package, just add a `tslint.json` to that package containing `{ "extends": "dtslint/dt.json" }`. All new packages must be linted.
|
||||
If a `tslint.json` turns rules off, this is because that hasn't been fixed yet. For example:
|
||||
All new packages must be linted. To lint a package, add a `tslint.json` to that package containing
|
||||
```js
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
```
|
||||
|
||||
This should be the only content in a finished project's `tslint.json` file. If a `tslint.json` turns rules off, this is because that hasn't been fixed yet. For example:
|
||||
|
||||
```js
|
||||
{
|
||||
@@ -336,3 +342,6 @@ This project is licensed under the MIT license.
|
||||
Copyrights on the definition files are respective of each contributor listed at the beginning of each definition file.
|
||||
|
||||
[](https://github.com/igrigorik/ga-beacon)
|
||||
|
||||
[](https://typescript.visualstudio.com/TypeScript/_build/latest?definitionId=13) Are packages being published to npm in less than 10,000 seconds on average?
|
||||
[](https://typescript.visualstudio.com/TypeScript/_build/latest?definitionId=14) Has typescript-bot been active on DefinitelyTyped in the last two hours?
|
||||
|
||||
+353
@@ -0,0 +1,353 @@
|
||||
<!-- markdownlint-disable MD001 MD012 MD026 -->
|
||||
|
||||
# DefinitelyTyped [](https://travis-ci.org/DefinitelyTyped/DefinitelyTyped)
|
||||
|
||||
[](https://gitter.im/borisyankov/DefinitelyTyped?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
|
||||
> Репозиторий для *высококачественных* определений типов TypeScript.
|
||||
|
||||
Также посетите веб-сайт [definitelytyped.org](http://definitelytyped.org), хотя информация в этом README более свежая.
|
||||
|
||||
*Вы также можете прочитать этот README на [английском](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md), [испанском](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.es.md) and [корейском](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.ko.md).*
|
||||
|
||||
## Что такое файлы декларации (файлы описания/объявления типов)?
|
||||
|
||||
Смотрите [руководство по TypeScript](http://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html).
|
||||
|
||||
## Как их получить?
|
||||
|
||||
### npm
|
||||
|
||||
Это предпочтительный метод. Это доступно только для пользователей TypeScript 2.0+. Например:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @types/node
|
||||
```
|
||||
|
||||
Затем типы должны автоматически включаться компилятором.
|
||||
Подробнее смотрите в [справочнике](http://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html).
|
||||
|
||||
Для пакета NPM "foo", описания будут находиться в "@types/foo".
|
||||
Если вы не можете найти свой пакет, ищите его в [TypeSearch](https://microsoft.github.io/TypeSearch/).
|
||||
|
||||
Если вы все еще не можете найти его, проверьте [включает](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) ли пакет собственную типизацию.
|
||||
Обычно это отражается в поле `"types"` или `"typings"` файла `package.json`, или просто ищите любые файлы ".d.ts" в пакете и вручную включайте их в `/// <reference path="" />`.
|
||||
|
||||
|
||||
### Другие методы
|
||||
|
||||
Эти методы могут быть использованы TypeScript 1.0.
|
||||
|
||||
* [Typings](https://github.com/typings/typings)
|
||||
* ~~[NuGet](http://nuget.org/packages?q=DefinitelyTyped)~~ (используйте предпочтительные альтернативы, публикация типа nuget DT отключена)
|
||||
* Вручную загрузите из ветки `master` этого репозитория
|
||||
|
||||
Возможно, вам придется добавить ручные [ссылки](http://www.typescriptlang.org/docs/handbook/triple-slash-directives.html).
|
||||
|
||||
|
||||
## Как я могу внести свой вклад?
|
||||
|
||||
DefinitelyTyped работает только благодаря вкладу таких пользователей, как вы!
|
||||
|
||||
### Тестирование
|
||||
|
||||
Прежде чем поделиться своим улучшением с миром, используйте его сами.
|
||||
|
||||
#### Тестирование редактирования существующего пакета
|
||||
|
||||
Для добавления новых функций вы можете использовать [разрешение модулей](http://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation).
|
||||
Вы также можете напрямую редактировать типы в `node_modules/@types/foo/index.d.ts`, или скопировать их оттуда и выполнить следующие шаги.
|
||||
|
||||
|
||||
#### Тестирование ногово пакета
|
||||
|
||||
Добавьте к вашему `tsconfig.json`:
|
||||
|
||||
```json
|
||||
"baseUrl": "types",
|
||||
"typeRoots": ["types"],
|
||||
```
|
||||
|
||||
(Вы также можете использовать `src/types`.)
|
||||
Создайте `types/foo/index.d.ts` содержащие объявления для модуля "foo".
|
||||
Теперь вы сможете импортировать из `"foo"` в свой код, и он будет направлен к новому определению типа.
|
||||
Затем запустите сборку (build) *и* запустите код, чтобы убедиться, что ваше определение типа действительно соответствует тому, что происходит во время выполнения.
|
||||
После того как вы проверили свои определения с реальным кодом, создайте [Запрос на принятие изменений (PR)](#make-a-pull-request)
|
||||
и следуйте инструкциям [чтобы отредактировать существующий](#edit-an-existing-package) или
|
||||
[создать новый пакет](#create-a-new-package).
|
||||
|
||||
|
||||
### Запрос на принятие изменений (PR)
|
||||
|
||||
После того, как вы проверили ваш пакет, вы можете поделиться им с DefinitelyTyped.
|
||||
|
||||
Во-первых, [разветвите](https://guides.github.com/activities/forking/) этот репозиторий, установите [node](https://nodejs.org/), и запустите `npm install`.
|
||||
|
||||
|
||||
#### Изменение существующего пакета
|
||||
|
||||
* `cd types/my-package-to-edit`
|
||||
* Внесите изменения. Не забудьте отредактировать тесты.
|
||||
Если вы вносите критические изменения, не забудьте [обновить основную версию](#i-want-to-update-a-package-to-a-new-major-version).
|
||||
* Вы также можете добавить себя в раздел "Definitions by" заголовка пакета.
|
||||
* Это приведет к тому, что вы будете уведомлены (через ваше имя пользователя GitHub) о том, что кто-то делает запрос на принятие изменений (PR) или проблему с пакетом.
|
||||
* Сделайте это, добавив свое имя в конец строки, например `// Definitions by: Alice <https://github.com/alice>, Bob <https://github.com/bob>`.
|
||||
* Или, если есть больше людей, это может быть многострочным
|
||||
|
||||
```typescript
|
||||
// Definitions by: Alice <https://github.com/alice>
|
||||
// Bob <https://github.com/bob>
|
||||
// Steve <https://github.com/steve>
|
||||
// John <https://github.com/john>
|
||||
```
|
||||
|
||||
* Если есть `tslint.json`, запустите `npm run lint package-name`. В противном случае запустите `tsc` in в директории пакета.
|
||||
|
||||
Когда вы создаете PR для редактирования существующего пакета, `dt-bot` должен @-уведомить previous authors.
|
||||
предыдущих авторов. Если этого не произойдет, вы можете сделать это самостоятельно в комментарии, связанном с PR.
|
||||
|
||||
|
||||
#### Созданое нового пакета
|
||||
|
||||
Если вы являетесь автором библиотеки и ваш пакет написан на TypeScript, [свяжите автоматически сгенерированные файлы объявлений](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) в вашем пакете, а не публикуйте в DefinitelyTyped.
|
||||
|
||||
Если вы добавляете типизацию для пакета NPM, создайте директорию с тем же именем.
|
||||
Если пакет, для которого вы добавляете типизацию, отсутствует в NPM, убедитесь, что выбранное вами имя не конфликтует с именем пакета в NPM.
|
||||
(Вы можете использовать `npm info foo` чтобы проверить наличие пакета `foo`.)
|
||||
|
||||
Ваш пакет должен иметь такую структуру:
|
||||
|
||||
| Файл | Назначение |
|
||||
| ------------- | ---------------------------------------------------------------------------------------------------- |
|
||||
| index.d.ts | Содержит типизацию для пакета. |
|
||||
| foo-tests.ts | Содержит пример кода, который проверяет типизацию. Этот код *не* запускается, но он проверен на тип. |
|
||||
| tsconfig.json | Позволяет вам запускать `tsc` внутри пакета. |
|
||||
| tslint.json | Включает linting. |
|
||||
|
||||
Создайте их, запустив `npx dts-gen --dt --name my-package-name --template module` если у вас ≥ 5.2.0, `npm install -g dts-gen` и `dts-gen --dt --name my-package-name --template module` в противном случае.
|
||||
Посмотреть все варианты на [dts-gen](https://github.com/Microsoft/dts-gen).
|
||||
|
||||
Вы можете отредактировать `tsconfig.json` чтобы добавить новые файлы, добавить `"target": "es6"` (необходимо для асинхронных функций), добавить в `"lib"`, или добавить опцию компилятора `"jsx"`.
|
||||
|
||||
Члены группы DefinitelyTyped регулярно следят за новыми PR, но имейте в виду, что количество других PR может замедлить ход событий.
|
||||
|
||||
Хороший пример пакета смотрите [base64-js](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/base64-js).
|
||||
|
||||
|
||||
#### Распространенные ошибки
|
||||
|
||||
* Сначала следуйте советам из справочника [handbook](http://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html).
|
||||
* Форматирование: либо используйте все табы, либо всегда используйте 4 пробела.
|
||||
* `function sum(nums: number[]): number`: используйте `ReadonlyArray` если функция не записывает свои параметры.
|
||||
* `interface Foo { new(): Foo; }`:
|
||||
Это определяет тип объектов, с методом `new`. Вы, вероятно, хотите объявить `declare class Foo { constructor(); }`.
|
||||
* `const Class: { new(): IClass; }`:
|
||||
Предпочитайте использовать объявление класса `class Class { constructor(); }` вместо `new`.
|
||||
* `getMeAT<T>(): T`:
|
||||
Если параметр типа не отображается в типах каких-либо параметров, у вас нет универсальной функции, а просто замаскированное утверждение типа.
|
||||
Предпочитайте использовать утверждение реального типа, например, `getMeAT() as number`.
|
||||
Пример, где допустим параметр типа: `function id<T>(value: T): T;`.
|
||||
Пример, где это недопустимо: `function parseJson<T>(json: string): T;`.
|
||||
Исключение: `new Map<string, number>()` все ОК.
|
||||
* Использование типов `Function` and `Object` почти никогда не является хорошей идеей. В 99% случаев можно указать более конкретный тип. Примеры: `(x: number) => number` для [функций](http://www.typescriptlang.org/docs/handbook/functions.html#function-types) and `{ x: number, y: number }` для объектов. Если нет никакой уверенности в типе, [`any`](http://www.typescriptlang.org/docs/handbook/basic-types.html#any) является правильным выбором, а не `Object`. Если единственным известным фактом о типе является то, что это какой-то объект, используйте тип [`object`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#object-type), а не `Object` или `{ [key: string]: any }`.
|
||||
* `var foo: string | any`:
|
||||
когда `any` используется в типе объединения, результирующий тип все еще `any`. Таким образом, хотя `string` часть аннотации этого типа может _выглядеть_ полезной, на самом деле она не предлагает никакой дополнительной проверки типов по сравнению с простым использованием `any`.
|
||||
В зависимости от намерения, приемлемыми альтернативами могут быть `any`, `string`, или `string | object`.
|
||||
|
||||
|
||||
#### Удаление пакета
|
||||
|
||||
Когда пакет [объединяет](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) свои собственные типы, типы должны быть удалены из DefinitelyTyped чтобы избежать путаницы.
|
||||
|
||||
Вы можете удалить его, запустив `npm run not-needed -- typingsPackageName asOfVersion sourceRepoURL [libraryName]`.
|
||||
|
||||
* `typingsPackageName`: название директории, который нужно удалить.
|
||||
* `asOfVersion`: заглушка будет опубликована в `@types/foo` с этой версией. Должна быть выше, чем любая опубликованная на данный момент версия
|
||||
* `sourceRepoURL`: Это должно указывать на репозиторий, который содержит типизации.
|
||||
* `libraryName`: описательное имя библиотеки, например, "Angular 2" вместо "angular2". (Если опущено, будет идентично "typingsPackageName".)
|
||||
|
||||
Любые другие пакеты в DefinitelyTyped которые ссылаются на удаленный пакет, должны быть обновлены для ссылки на связанные типы. Для этого добавьте в `package.json` ссыклу `"dependencies": { "foo": "x.y.z" }`.
|
||||
|
||||
Если пакет никогда не был в DefinitelyTyped, его не нужно добавлять в `notNeededPackages.json`.
|
||||
|
||||
|
||||
#### Lint
|
||||
|
||||
Все новые пакеты должны быть проанализированы lint. Для этого добавьте `tslint.json` в этот пакет, содержащий
|
||||
|
||||
```js
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
```
|
||||
|
||||
Это должно быть единственным содержимым в файле `tslint.json` готового проекта. Если `tslint.json` отключает правила, это потому, что это еще не исправлено. Например:
|
||||
|
||||
```js
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
// This package uses the Function type, and it will take effort to fix.
|
||||
"ban-types": false
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
(Чтобы указать, что правило lint действительно не применяется, используйте `// tslint:disable rule-name` или лучше, `//tslint:disable-next-line rule-name`.)
|
||||
|
||||
Чтобы проверить, что выражение имеет заданный тип, используйте `$ExpectType`. Чтобы проверить, что выражение вызывает ошибку компиляции, используйте `$ExpectError`.
|
||||
|
||||
```js
|
||||
// $ExpectType void
|
||||
f(1);
|
||||
|
||||
// $ExpectError
|
||||
f("one");
|
||||
```
|
||||
|
||||
Для получения дополнительной информации см. [dtslint](https://github.com/Microsoft/dtslint#write-tests) readme.
|
||||
|
||||
Протестируйте, запустив `npm run lint package-name` где `package-name` - это имя вашего пакета.
|
||||
Этот скрипт использует [dtslint](https://github.com/Microsoft/dtslint).
|
||||
|
||||
|
||||
## Часто задаваемые вопросы
|
||||
|
||||
#### Какая связь между этим репозиторием и пакетами `@types` в NPM?
|
||||
|
||||
Ветвь `master` автоматически публикуется в область `@types` на NPM благодаря [types-publisher](https://github.com/Microsoft/types-publisher).
|
||||
|
||||
#### Я отправил PR. Когда он сольется?
|
||||
|
||||
Это зависит, но большинство запросов на получение данных будут объединены в течение недели. PR, утвержденные автором, указанным в заголовке определения, обычно объединяются быстрее; PR для новых определений займет больше времени, так как они требуют большего количества проверок от сопровождающих. Каждый PR проверяется членом команды TypeScript или DefinitelyTyped перед объединением, поэтому будьте терпеливы, так как человеческий фактор может вызвать задержки. Посмотрите на [PR Burndown Board](https://github.com/DefinitelyTyped/DefinitelyTyped/projects/3?card_filter_query=is%3Aopen) чтобы увидеть, как сопровождающие работают через открытые PR.
|
||||
|
||||
#### Мой PR слит; когда будет обновлен пакет `@types` NPM?
|
||||
|
||||
Пакеты NPM должны обновиться в течение нескольких часов. Если прошло более 24 часов, пингуйте @RyanCavanaugh и @andy-ms в PR, чтобы расследовать.
|
||||
|
||||
#### Я пишу определение, которое зависит от другого определения. Должен ли я использовать `<reference types="" />` или import?
|
||||
|
||||
Если модуль, на который вы ссылаетесь, является внешним модулем (использует `export`), используйте import.
|
||||
Если модуль, на который вы ссылаетесь, является окружающим модулем (использует `declare module`, или просто объявляет глобальные переменные), используйте `<reference types="" />`.
|
||||
|
||||
#### Я заметил, что у некоторых пакетов есть `package.json`.
|
||||
|
||||
Обычно вам это не нужно. При публикации пакета мы обычно автоматически создаем `package.json`.
|
||||
`package.json` может быть включен для определения зависимостей. Вот [пример](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/pikaday/package.json).
|
||||
Мы не разрешаем определять другие поля, такие как "description", вручную.
|
||||
Кроме того, если вам нужно сослаться на более старую версию типизаций, вы должны сделать это, добавив в `package.json` строки `"dependencies": { "@types/foo": "x.y.z" }`.
|
||||
|
||||
#### В некоторых пакетах отсутствует `tslint.json`, а в некоторых `tsconfig.json` отсутствует `"noImplicitAny": true`, `"noImplicitThis": true`, или `"strictNullChecks": true`.
|
||||
|
||||
Тогда они не правы. Вы можете помочь, отправив PR, чтобы исправить их.
|
||||
|
||||
#### Могу ли я запросить определение?
|
||||
|
||||
Вот [текущие запрошенные определения](https://github.com/DefinitelyTyped/DefinitelyTyped/labels/Definition%3ARequest).
|
||||
|
||||
#### Как насчет определений типов для DOM?
|
||||
|
||||
Если типы являются частью веб-стандарта, они должны быть добавлены в [TSJS-lib-generator](https://github.com/Microsoft/TSJS-lib-generator) чтобы они могли стать частью `lib.dom.d.ts` по умолчанию.
|
||||
|
||||
#### Пакет использует export `export =`, но я предпочитаю использовать импорт по умолчанию. Могу ли я изменить `export =` на `export default`?
|
||||
|
||||
Если вы используете TypeScript 2.7 или более позднюю версию, используйте `--esModuleInterop` в вашем проекте.
|
||||
В противном случае, если импорт по умолчанию работает в вашей среде (например, Webpack, SystemJS, esm), рассмотрите возможность включения опции компилятора [`--allowSyntheticDefaultImports`](http://www.typescriptlang.org/docs/handbook/compiler-options.html).
|
||||
Не меняйте определение типа, если оно точное.
|
||||
Для пакета NPM, `export =` является точным, если `node -p 'require("foo")'` является экспортом, а `export default` является точным, если `node -p 'require("foo").default'` является экспортом.
|
||||
|
||||
#### Я хочу использовать функции из TypeScript 2.1 или выше.
|
||||
|
||||
В таком случае вам нужно будет добавить комментарий к последней строке заголовка вашего определения (после `// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped`): `// TypeScript Version: 2.1`.
|
||||
|
||||
#### Я хочу добавить DOM API, отсутствующий в TypeScript по умолчанию.
|
||||
|
||||
Это может принадлежать [TSJS-Lib-Generator](https://github.com/Microsoft/TSJS-lib-generator#readme). Смотрите инструкции там.
|
||||
Если стандарт все еще является черновиком, добавляйте сюда.
|
||||
Используйте имя, начинающееся с `dom-` и включите ссылку на стандарт в качестве ссылки "Project" в заголовке.
|
||||
Когда он завершает черновой режим, мы можем удалить его из DefinitelyTyped и объявить устаревшим связанный пакет `@types`.
|
||||
|
||||
#### Я хочу обновить пакет новой старшей версии
|
||||
|
||||
Если вы намерены продолжить обновление старой версии пакета, вы можете создать новую подпапку с текущей версией, например, `v2` и скопируйте в него существующие файлы. Если это так, вам необходимо:
|
||||
|
||||
1. Обновите относительные пути в `tsconfig.json` а также в `tslint.json`.
|
||||
2. Добавьте правила сопоставления путей, чтобы убедиться, что тесты выполняются для предполагаемой версии.
|
||||
|
||||
Например [history v2 `tsconfig.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/history/v2/tsconfig.json) looks like:
|
||||
|
||||
```json
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": ["../../"],
|
||||
"paths": {
|
||||
"history": [ "history/v2" ]
|
||||
},
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"history-tests.ts"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Если в DefinitelyTyped есть другие пакеты, несовместимые с новой версией, вам нужно будет добавить сопоставления путей к старой версии. Вам также нужно будет сделать это для пакетов в зависимости от пакетов в зависимости от старой версии.
|
||||
|
||||
Например, `react-router` зависит от `history@2`, поэтому [react-router `tsconfig.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-router/tsconfig.json) есть сопоставление пути с `"history": [ "history/v2" ]`;
|
||||
транзитивно `react-router-bootstrap` (который зависит от `react-router`) также добавляет отображение пути в свой [tsconfig.json](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-router-bootstrap/tsconfig.json).
|
||||
|
||||
Также, `/// <reference types=".." />` не будет работать с отображением пути, поэтому зависимости должны использовать `import`.
|
||||
|
||||
#### Как мне написать определения для пакетов, которые могут использоваться и глобально и в качестве модуля?
|
||||
|
||||
Руководство TypeScript содержит отличную [общую информацию о написании определений](https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html), а также [этот пример файла определения](https://www.typescriptlang.org/docs/handbook/declaration-files/templates/global-modifying-module-d-ts.html) , в котором показано, как создать определение с использованием синтаксиса модуля в стиле ES6, а также указаны объекты, доступные для глобальной области. Этот метод демонстрируется практически в определении для [definition for big.js](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/big.js/index.d.ts), библиотекой, которую можно загружать глобально с помощью тега скрипта на веб-странице или импортировать с помощью импорта по требованию или в стиле ES6.
|
||||
|
||||
Чтобы проверить, как ваше определение может использоваться как при глобальных ссылках, так и в качестве импортированного модуля, создайте тестовую папку `test`, и поместите туда два тестовых файла. Назовите один `YourLibraryName-global.test.ts` а другой `YourLibraryName-module.test.ts`. *Глобальный* тестовый файл должен использовать определение в соответствии с тем, как он будет использоваться в скрипте, загруженном на веб-страницу, где библиотека доступна в глобальной области видимости - в этом сценарии не следует указывать оператор импорта. Тестовый файл *модуля* должен использовать определение в соответствии с тем, как оно будет использоваться при импорте (включая оператор(ы) `import`). Если вы указали свойство `files` в файле `tsconfig.json`, обязательно включите оба тестовых файла. [Практический пример этого](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/big.js/test) также доступен в определении big.js.
|
||||
|
||||
Обратите внимание, что не требуется полностью использовать определение в каждом тестовом файле - достаточно протестировать только глобально доступные элементы в глобальном тестовом файле и полностью выполнить определение в тестовом файле модуля, или наоборот.
|
||||
|
||||
#### А как насчет областных пакетов?
|
||||
|
||||
Типы для пакета с областью `@foo/bar` должны указываться в `types/foo__bar`. Обратите внимание на двойное подчеркивание.
|
||||
|
||||
Когда `dts-gen` используется для компоновки пакета с областью действия, свойство `paths` должно быть вручную адаптировано в сгенерированном файле
|
||||
`tsconfig.json` для правильной ссылки на пакет с областью действия:
|
||||
|
||||
```json
|
||||
{
|
||||
"paths":{
|
||||
"@foo/bar": ["foo__bar"]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
#### История файлов в GitHub выглядит неполной.
|
||||
|
||||
GitHub не [поддерживает](http://stackoverflow.com/questions/5646174/how-to-make-github-follow-directory-history-after-renames) историю файлов для переименованных файлов. Вместо этого используйте [`git log --follow`](https://www.git-scm.com/docs/git-log).
|
||||
|
||||
#### Должен ли я добавить пустой namespace в пакет, который не экспортирует модуль для использования импорта в стиле ES6?
|
||||
|
||||
Некоторые пакеты, такие как [chai-http](https://github.com/chaijs/chai-http), экспортируют функцию.
|
||||
|
||||
Импорт этого модуля с импортом в стиле ES6 в форме `import * as foo from "foo";` приводит к ошибке:
|
||||
|
||||
> error TS2497: Module 'foo' resolves to a non-module entity and cannot be imported using this construct
|
||||
|
||||
Эту ошибку можно устранить, объединив объявление функции с пустым namespace'ом с тем же именем, но это не рекомендуется.
|
||||
Это часто цитируемый [ответ с Stack Overflow](https://stackoverflow.com/questions/39415661/what-does-resolves-to-a-non-module-entity-and-cannot-be-imported-using-this) по этому вопросу.
|
||||
|
||||
Более целесообразно импортировать модуль, используя `import foo = require("foo");` синтаксис или использовать импорт по умолчанию, такой как `import foo from "foo";` при использовании флага `--allowSyntheticDefaultImports`, если среда выполнения вашего модуля поддерживает схему взаимодействия для модулей не-ECMAScript как таковых.
|
||||
|
||||
## Лицензия
|
||||
|
||||
Этот проект лицензирован по лицензии MIT.
|
||||
|
||||
Авторские права на файлы определений принадлежат каждому участнику, указанному в начале каждого файла определения.
|
||||
|
||||
[](https://github.com/igrigorik/ga-beacon)
|
||||
|
||||
[](https://typescript.visualstudio.com/TypeScript/_build/latest?definitionId=13) В среднем пакеты публикуются на npm менее чем за 10000 секунд?
|
||||
|
||||
[](https://typescript.visualstudio.com/TypeScript/_build/latest?definitionId=14) Был ли typescript-bot активным на DefinitelyTyped в последние два часа?
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
// Type definitions for node-gettext 2.0
|
||||
// Project: http://github.com/alexanderwallin/node-gettext
|
||||
// Definitions by: Sameer K.C. <https://github.com/sameercaresu>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = GetText;
|
||||
declare class GetText {
|
||||
constructor(options?: { debug: boolean; });
|
||||
addTranslations(locale: string, domain: string, translations: object): void;
|
||||
dgettext(domain: string, msgid: string): string;
|
||||
dngettext(domain: string, msgid: string, msgidPlural: string, count: number): string;
|
||||
dnpgettext(domain: string, msgctxt: string, msgid: string, msgidPlural: string, count: number): string;
|
||||
dpgettext(domain: string, msgctxt: string, msgid: string): string;
|
||||
emit(eventName: string, eventData: any): void;
|
||||
getComment(domain: string, msgctxt: string, msgid: string): object | boolean;
|
||||
gettext(msgid: string): string;
|
||||
ngettext(msgid: string, msgidPlural: string, count: number): string;
|
||||
npgettext(msgctxt: string, msgid: string, msgidPlural: string, count: number): string;
|
||||
off(eventName: string, callback: (params: any) => void): string;
|
||||
on(eventName: string, callback: (params: any) => void): void;
|
||||
pgettext(msgctxt: string, msgid: string): string;
|
||||
setLocale(locale: string): void;
|
||||
setTextDomain(domain: string): void;
|
||||
static getLanguageCode(locale: string): string;
|
||||
textdomain(domain: string): void;
|
||||
warn(message: string): void;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// with tsc v 2.7 & esModuleInterop & allowSyntheticDefaultImports enabled in tsconfig.json
|
||||
import Gettext from 'node-gettext';
|
||||
// or without
|
||||
// import Gettext = require('node-getttext');
|
||||
|
||||
const translations = {};
|
||||
const gt = new Gettext({ debug: true });
|
||||
const msgid = 'Get translation';
|
||||
const msgidPlural = 'Get translations';
|
||||
const domain = 'domain';
|
||||
const msgctxt = 'context';
|
||||
const count = 2;
|
||||
|
||||
gt.addTranslations('en-US', 'messages', translations);
|
||||
gt.setTextDomain(domain);
|
||||
gt.textdomain(domain);
|
||||
gt.setLocale('en-US');
|
||||
gt.gettext(msgid);
|
||||
gt.dgettext('', msgid);
|
||||
gt.dngettext(domain, msgid, msgidPlural, count);
|
||||
gt.dnpgettext(domain, msgctxt, msgid, msgidPlural, count);
|
||||
gt.dpgettext(domain, msgctxt, msgid);
|
||||
gt.getComment(domain, msgctxt, msgid);
|
||||
gt.ngettext(msgid, msgidPlural, count);
|
||||
gt.npgettext(msgctxt, msgid, msgidPlural, count);
|
||||
gt.pgettext(msgctxt, msgid);
|
||||
Gettext.getLanguageCode('en-US');
|
||||
gt.warn('warning');
|
||||
const errorListener = (error: string) => {
|
||||
// do something;
|
||||
};
|
||||
gt.on('error', errorListener);
|
||||
gt.emit('error', 'Error occurred');
|
||||
gt.off('error', errorListener);
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"esModuleInterop": true,
|
||||
"allowSyntheticDefaultImports": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"node-gettext-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -642,6 +642,12 @@
|
||||
"sourceRepoURL": "https://github.com/jdalrymple/node-gitlab",
|
||||
"asOfVersion": "2.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "Google Cloud Storage",
|
||||
"typingsPackageName": "google-cloud__storage",
|
||||
"sourceRepoURL": "https://github.com/googleapis/nodejs-storage",
|
||||
"asOfVersion": "2.3.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "graphene-pk11",
|
||||
"typingsPackageName": "graphene-pk11",
|
||||
@@ -1476,6 +1482,12 @@
|
||||
"sourceRepoURL": "https://github.com/zeh/simplesignal",
|
||||
"asOfVersion": "1.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "sip.js",
|
||||
"typingsPackageName": "sip.js",
|
||||
"sourceRepoURL": "https://github.com/onsip/SIP.js",
|
||||
"asOfVersion": "0.12.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "smooth-scrollbar",
|
||||
"typingsPackageName": "smooth-scrollbar",
|
||||
@@ -1506,6 +1518,12 @@
|
||||
"sourceRepoURL": "https://github.com/mozilla/source-map",
|
||||
"asOfVersion": "0.5.7"
|
||||
},
|
||||
{
|
||||
"libraryName": "Spectacle",
|
||||
"typingsPackageName": "spectacle",
|
||||
"sourceRepoURL": "http://github.com/FormidableLabs/spectacle/",
|
||||
"asOfVersion": "5.2.3"
|
||||
},
|
||||
{
|
||||
"libraryName": "Spin.js",
|
||||
"typingsPackageName": "spin.js",
|
||||
@@ -1656,6 +1674,12 @@
|
||||
"sourceRepoURL": "https://github.com/ansman/validate.js",
|
||||
"asOfVersion": "0.11.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "vega",
|
||||
"typingsPackageName": "vega",
|
||||
"sourceRepoURL": "https://github.com/vega/vega",
|
||||
"asOfVersion": "3.2.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "vso-node-api",
|
||||
"typingsPackageName": "vso-node-api",
|
||||
|
||||
+3
-2
@@ -22,6 +22,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"dtslint": "github:Microsoft/dtslint#production",
|
||||
"types-publisher": "Microsoft/types-publisher#production"
|
||||
}
|
||||
"types-publisher": "github:Microsoft/types-publisher#production"
|
||||
},
|
||||
"dependencies": {}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
import * as accept from 'accept';
|
||||
|
||||
accept.charsets("iso-8859-5, unicode-1-1;q=0.8"); // charset === "iso-8859-5"
|
||||
accept.charset("iso-8859-5, unicode-1-1;q=0.8", ["unicode-1-1"]); // charset === "unicode-1-1"
|
||||
|
||||
accept.encoding("gzip, deflate, sdch"); // encoding === "gzip"
|
||||
accept.encoding("gzip, deflate, sdch", ["deflate", "identity"]);
|
||||
|
||||
const encodings = accept.encodings("compress;q=0.5, gzip;q=1.0"); // encodings === ["gzip", "compress", "identity"]
|
||||
encodings.lastIndexOf('');
|
||||
|
||||
accept.language("en;q=0.7, en-GB;q=0.8");
|
||||
accept.language("en;q=0.7, en-GB;q=0.8", ["en-gb"]); // language === "en-GB"
|
||||
const languages = accept.languages("da, en;q=0.7, en-GB;q=0.8"); // languages === ["da", "en-GB", "en"]
|
||||
languages.lastIndexOf('');
|
||||
|
||||
const mediaTypes = accept.mediaTypes("text/plain, application/json;q=0.5, text/html, */*;q=0.1");
|
||||
// mediaTypes === ["text/plain", "text/html", "application/json", "*/*"]
|
||||
mediaTypes.lastIndexOf('');
|
||||
const headers = {
|
||||
accept: 'text/plain, application/json;q=0.5, text/html, */*;q=0.1',
|
||||
'accept-language': 'da, en;q=0.7, en-GB;q=0.8'
|
||||
};
|
||||
|
||||
const all = accept.parseAll(headers);
|
||||
all.charsets.length;
|
||||
all.encodings.length;
|
||||
all.languages.length;
|
||||
all.mediaTypes.length;
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
// Type definitions for accept 3.1
|
||||
// Project: https://github.com/hapijs/accept#readme
|
||||
// Definitions by: feinoujc <https://github.com/feinoujc>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
export function charset(charsetHeader?: string, preferences?: string[]): string;
|
||||
export function charsets(charsetHeader?: string): string[];
|
||||
export function encoding(encodingHeader?: string, preferences?: string[]): string;
|
||||
export function encodings(encodingHeader?: string): string[];
|
||||
export function language(languageHeader?: string, preferences?: string[]): string;
|
||||
export function languages(languageHeader?: string): string[];
|
||||
export function mediaTypes(mediaTypeHeader?: string): string[];
|
||||
export function parseAll(
|
||||
headers: Record<string, string | string[] | undefined>
|
||||
): {
|
||||
charsets: string[];
|
||||
encodings: string[];
|
||||
languages: string[];
|
||||
mediaTypes: string[];
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"accept-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+11
-1
@@ -549,6 +549,16 @@ declare namespace AceAjax {
|
||||
getFoldsInRange(range: Range): any;
|
||||
|
||||
highlight(text: string): void;
|
||||
|
||||
|
||||
/**
|
||||
* Highlight lines from `startRow` to `EndRow`.
|
||||
* @param startRow Define the start line of the highlight
|
||||
* @param endRow Define the end line of the highlight
|
||||
* @param clazz Set the CSS class for the marker
|
||||
* @param inFront Set to `true` to establish a front marker
|
||||
**/
|
||||
highlightLines(startRow:number, endRow: number, clazz: string, inFront: boolean): Range;
|
||||
|
||||
/**
|
||||
* Sets the `EditSession` to point to a new `Document`. If a `BackgroundTokenizer` exists, it also points to `doc`.
|
||||
@@ -1223,7 +1233,7 @@ declare namespace AceAjax {
|
||||
/**
|
||||
* Returns `true` if the current `textInput` is in focus.
|
||||
**/
|
||||
isFocused(): void;
|
||||
isFocused(): boolean;
|
||||
|
||||
/**
|
||||
* Blurs the current `textInput`.
|
||||
|
||||
Vendored
+1
-3
@@ -246,9 +246,7 @@ declare namespace acorn {
|
||||
let LooseParser: ILooseParserClass | undefined;
|
||||
let pluginsLoose: PluginsObject | undefined;
|
||||
|
||||
interface ILooseParserClass {
|
||||
new (input: string, options?: Options): ILooseParser;
|
||||
}
|
||||
type ILooseParserClass = new (input: string, options?: Options) => ILooseParser;
|
||||
|
||||
interface ILooseParser {}
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import activeWin = require('active-win');
|
||||
|
||||
// $ExpectType Promise<Result>
|
||||
activeWin();
|
||||
// $ExpectType Result
|
||||
activeWin.sync();
|
||||
|
||||
let win = {
|
||||
title: 'Unicorns - Google Search',
|
||||
id: 5762,
|
||||
owner: {
|
||||
name: 'Google Chrome',
|
||||
processId: 310,
|
||||
},
|
||||
};
|
||||
|
||||
win = activeWin.sync();
|
||||
Vendored
+30
@@ -0,0 +1,30 @@
|
||||
// Type definitions for active-win 4.0
|
||||
// Project: https://github.com/sindresorhus/active-win#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = activeWin;
|
||||
|
||||
declare function activeWin(): Promise<activeWin.Result>;
|
||||
|
||||
declare namespace activeWin {
|
||||
function sync(): Result;
|
||||
|
||||
interface Result {
|
||||
title: string;
|
||||
id: number;
|
||||
bounds?: {
|
||||
x: number;
|
||||
y: number;
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
owner: {
|
||||
name: string;
|
||||
processId: number;
|
||||
bundleId?: number;
|
||||
path?: string;
|
||||
};
|
||||
memoryUsage?: number;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"active-win-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+16
@@ -319,6 +319,22 @@ export interface Utils {
|
||||
delimiter?: string
|
||||
): void;
|
||||
};
|
||||
device: {
|
||||
isWebXRAvailable: boolean;
|
||||
getVRDisplay(): VRDisplay[];
|
||||
checkHeadsetConnected(): boolean;
|
||||
checkHasPositionalTracking(): boolean;
|
||||
isMobile(): boolean;
|
||||
isTablet(): boolean;
|
||||
isIOS(): boolean;
|
||||
isGearVR(): boolean;
|
||||
isOculusGo(): boolean;
|
||||
isR7(): boolean;
|
||||
isLandscape(): boolean;
|
||||
isBrowserEnvironment(): boolean;
|
||||
isNodeEnvironment(): boolean;
|
||||
PolyfillControls(object3D: THREE.Object3D): void;
|
||||
};
|
||||
styleParser: {
|
||||
parse(value: string): object;
|
||||
stringify(data: object): string;
|
||||
|
||||
Vendored
-63
@@ -1,63 +0,0 @@
|
||||
import {
|
||||
ACLType,
|
||||
CopyAndPutMetaResult,
|
||||
CopyObjectOptions,
|
||||
DeleteMultiOptions,
|
||||
DeleteMultiResult,
|
||||
GetObjectOptions,
|
||||
GetObjectResult,
|
||||
GetStreamOptions,
|
||||
GetStreamResult,
|
||||
HeadObjectOptions,
|
||||
HeadObjectResult,
|
||||
ListObjectResult,
|
||||
ListObjectsQuery,
|
||||
NormalSuccessResponse,
|
||||
PutObjectOptions,
|
||||
PutObjectResult,
|
||||
PutStreamOptions,
|
||||
RequestOptions,
|
||||
SignatureUrlOptions,
|
||||
UserMeta
|
||||
} from "./index";
|
||||
|
||||
export interface ClusterType {
|
||||
host: string;
|
||||
accessKeyId: string;
|
||||
accessKeySecret: string;
|
||||
}
|
||||
|
||||
export interface ClusterOptions {
|
||||
clusters: ClusterType[];
|
||||
schedule?: string;
|
||||
}
|
||||
|
||||
export class Cluster {
|
||||
constructor(options: ClusterOptions)
|
||||
|
||||
list(query: ListObjectsQuery | null, options: RequestOptions): Promise<ListObjectResult>;
|
||||
|
||||
put(name: string, file: any, options?: PutObjectOptions): Promise<PutObjectResult>;
|
||||
|
||||
putStream(name: string, stream: any, options?: PutStreamOptions): Promise<{ name: string, res: NormalSuccessResponse }>;
|
||||
|
||||
head(name: string, options?: HeadObjectOptions): Promise<HeadObjectResult>;
|
||||
|
||||
get(name: string, file?: any, options?: GetObjectOptions): Promise<GetObjectResult>;
|
||||
|
||||
getStream(name?: string, options?: GetStreamOptions): Promise<GetStreamResult>;
|
||||
|
||||
delete(name: string, options?: RequestOptions): Promise<NormalSuccessResponse>;
|
||||
|
||||
copy(name: string, sourceName: string, options?: CopyObjectOptions): Promise<CopyAndPutMetaResult>;
|
||||
|
||||
putMeta(name: string, meta: UserMeta, options: RequestOptions): Promise<CopyAndPutMetaResult>;
|
||||
|
||||
deleteMulti(names: string[], options?: DeleteMultiOptions): Promise<DeleteMultiResult>;
|
||||
|
||||
signatureUrl(name: string, options?: SignatureUrlOptions): string;
|
||||
|
||||
putACL(name: string, acl: ACLType, options?: RequestOptions): Promise<NormalSuccessResponse>;
|
||||
|
||||
restore(name: string, options?: RequestOptions): Promise<NormalSuccessResponse>;
|
||||
}
|
||||
Vendored
-71
@@ -1,71 +0,0 @@
|
||||
import { NormalSuccessResponse, RequestOptions } from "./index";
|
||||
|
||||
export interface ImageClientOptions {
|
||||
imageHost: string; // your image service domain that binding to a OSS bucket
|
||||
accessKeyId: string; // access key you create on aliyun console website
|
||||
accessKeySecret: string; // access secret you create
|
||||
bucket: string; // the default bucket you want to access If you don't have any bucket, please use putBucket() create one first.
|
||||
region?: string; // the bucket data region location, please see Data Regions, default is oss-cn-hangzhou
|
||||
internal?: boolean; // access OSS with aliyun internal network or not, default is false If your servers are running on aliyun too, you can set true to save lot of money.
|
||||
timeout?: string | number; // instance level timeout for all operations, default is 60s
|
||||
}
|
||||
|
||||
export interface ImageGetOptions {
|
||||
timeout?: number;
|
||||
headers?: object;
|
||||
}
|
||||
|
||||
export interface StyleData {
|
||||
Name: string; // style name
|
||||
Content: string; // style content
|
||||
CreateTime: string; // style create time
|
||||
LastModifyTime: string; // style last modify time
|
||||
}
|
||||
export class ImageClient {
|
||||
constructor(options: ImageClientOptions)
|
||||
|
||||
/**
|
||||
* Get an image from the image channel.
|
||||
*/
|
||||
get(name: string, file?: any, options?: ImageGetOptions): Promise<{ content: any, res: NormalSuccessResponse }>;
|
||||
|
||||
/**
|
||||
* Get an image read stream.
|
||||
*/
|
||||
getStream(name: string, options?: ImageGetOptions): Promise<{ stream: any, res: NormalSuccessResponse }>;
|
||||
|
||||
/**
|
||||
* Get a image exif info by image object name from the image channel.
|
||||
*/
|
||||
getExif(name: string, options?: RequestOptions): Promise<{ data: object, res: NormalSuccessResponse }>;
|
||||
|
||||
/**
|
||||
* Get a image info and exif info by image object name from the image channel.
|
||||
*/
|
||||
getInfo(name: string, options?: RequestOptions): Promise<{ data: object, res: NormalSuccessResponse }>;
|
||||
|
||||
/**
|
||||
* todo
|
||||
*/
|
||||
putStyle(name: string, style: string, options?: RequestOptions): Promise<{ data: object, res: NormalSuccessResponse }>;
|
||||
|
||||
/**
|
||||
* Get a style by name from the image channel.
|
||||
*/
|
||||
getStyle(name: string, options?: RequestOptions): Promise<{ data: StyleData, res: NormalSuccessResponse}>;
|
||||
|
||||
/**
|
||||
* Get all styles from the image channel.
|
||||
*/
|
||||
listStyle(options?: RequestOptions): Promise<StyleData[]>;
|
||||
|
||||
/**
|
||||
* todo
|
||||
*/
|
||||
deleteStyle(styleName: string, options?: RequestOptions): Promise<NormalSuccessResponse>;
|
||||
|
||||
/**
|
||||
* Create a signature url for directly download.
|
||||
*/
|
||||
signatureUrl(name: string, options?: { expires?: string, timeout?: string }): string;
|
||||
}
|
||||
@@ -1,34 +1,25 @@
|
||||
import OSS from "ali-oss";
|
||||
import * as OSS from 'ali-oss';
|
||||
|
||||
const client = new OSS({
|
||||
const ossOptions: OSS.Options = {
|
||||
accessKeyId: 'your access key',
|
||||
accessKeySecret: 'your access secret',
|
||||
bucket: 'your bucket name',
|
||||
region: 'oss-cn-hangzhou'
|
||||
});
|
||||
};
|
||||
|
||||
const ImageClient = OSS.ImageClient({
|
||||
imageHost: 'host',
|
||||
accessKeySecret: "secret",
|
||||
accessKeyId: 'id',
|
||||
bucket: "",
|
||||
internal: false,
|
||||
region: "",
|
||||
timeout: 2000
|
||||
});
|
||||
const client = new OSS(ossOptions);
|
||||
|
||||
const cluster = OSS.Cluster({
|
||||
clusters: [
|
||||
{
|
||||
accessKeyId: 'id',
|
||||
accessKeySecret: 'secret',
|
||||
host: ""
|
||||
},
|
||||
{
|
||||
accessKeyId: 'id',
|
||||
accessKeySecret: 'secret',
|
||||
host: ""
|
||||
},
|
||||
],
|
||||
schedule: 'masterSlave',
|
||||
});
|
||||
const clusterOptions: OSS.ClusterOptions = {
|
||||
clusters: [],
|
||||
};
|
||||
|
||||
const clusterClient = new OSS.Cluster(clusterOptions);
|
||||
|
||||
const imageOptions: OSS.ImageClientOptions = {
|
||||
imageHost: 'xxxx',
|
||||
accessKeyId: 'xxxx',
|
||||
accessKeySecret: 'xxxx',
|
||||
bucket: 'xxxx'
|
||||
};
|
||||
|
||||
const imageClient = new OSS.ImageClient(imageOptions);
|
||||
|
||||
Vendored
+576
-463
File diff suppressed because it is too large
Load Diff
@@ -18,8 +18,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ImageClient.d.ts",
|
||||
"Cluster.d.ts",
|
||||
"ali-oss-tests.ts"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-mergeable-namespace": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
import allPropertyNames = require('all-property-names');
|
||||
|
||||
// $ExpectType Set<string>
|
||||
allPropertyNames(Symbol.prototype);
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// Type definitions for all-property-names 1.0
|
||||
// Project: https://github.com/sindresorhus/all-property-names#readme
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
export = allPropertyNames;
|
||||
|
||||
declare function allPropertyNames(input: object): Set<string>;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"all-property-names-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+3
-3
@@ -54,12 +54,12 @@ declare namespace AltJS {
|
||||
export type Source = {[name:string]: () => SourceModel<any>};
|
||||
|
||||
export interface SourceModel<S> {
|
||||
local(state:any, ...args: any[]):any;
|
||||
local?(state:any, ...args: any[]):any;
|
||||
remote(state:any, ...args: any[]):Promise<S>;
|
||||
shouldFetch?(fetchFn:(...args:Array<any>) => boolean):void;
|
||||
loading?:(args:any) => void;
|
||||
success?:(state:S) => void;
|
||||
error?:(args:any) => void;
|
||||
success:(state:S) => void;
|
||||
error:(args:any) => void;
|
||||
interceptResponse?(response:any, action:Action<any>, ...args:Array<any>):any;
|
||||
}
|
||||
|
||||
|
||||
+10
-1
@@ -136,7 +136,16 @@ export interface ChannelWrapper extends EventEmitter {
|
||||
* Setup functions should, ideally, not throw errors, but if they do then the ChannelWrapper will emit an 'error' event.
|
||||
* @param func
|
||||
*/
|
||||
addSetup(func: SetupFunc): Promise<void>;
|
||||
addSetup(func: SetupFunc): Promise<void>;
|
||||
|
||||
/**
|
||||
* Remove a setup function added with `addSetup`. If there is currently a
|
||||
* connection, `teardown(channel, [cb])` will be run immediately, and the
|
||||
* returned Promise will not resolve until it completes.
|
||||
* @param func
|
||||
* @param [tearDown]
|
||||
*/
|
||||
removeSetup(func: SetupFunc, tearDown?: SetupFunc): Promise<void>;
|
||||
|
||||
/**
|
||||
* @see amqplib
|
||||
|
||||
Vendored
+12
-8
@@ -22,8 +22,8 @@ declare namespace AnalyticsNode {
|
||||
},
|
||||
timestamp?: Date;
|
||||
messageId?: string;
|
||||
anonymousId: string | number;
|
||||
userId: string | number;
|
||||
anonymousId?: string | number;
|
||||
userId?: string | number;
|
||||
}
|
||||
|
||||
interface Data {
|
||||
@@ -47,7 +47,8 @@ declare namespace AnalyticsNode {
|
||||
/* The identify method lets you tie a user to their actions and record
|
||||
traits about them. */
|
||||
identify(message: {
|
||||
userId: string | number;
|
||||
userId?: string | number;
|
||||
anonymousId?: string | number;
|
||||
traits?: Object;
|
||||
timestamp?: Date;
|
||||
context?: Object;
|
||||
@@ -56,7 +57,8 @@ declare namespace AnalyticsNode {
|
||||
|
||||
/* The track method lets you record the actions your users perform. */
|
||||
track(message: {
|
||||
userId: string | number;
|
||||
userId?: string | number;
|
||||
anonymousId?: string | number;
|
||||
event: string;
|
||||
properties?: Object;
|
||||
timestamp?: Date;
|
||||
@@ -67,7 +69,8 @@ declare namespace AnalyticsNode {
|
||||
/* The page method lets you record page views on your website, along with
|
||||
optional extra information about the page being viewed. */
|
||||
page(message: {
|
||||
userId: string | number;
|
||||
userId?: string | number;
|
||||
anonymousId?: string | number;
|
||||
category?: string;
|
||||
name?: string;
|
||||
properties?: Object;
|
||||
@@ -79,19 +82,20 @@ declare namespace AnalyticsNode {
|
||||
/* alias is how you associate one identity with another. */
|
||||
alias(message: {
|
||||
previousId: string | number;
|
||||
userId: string | number;
|
||||
userId?: string | number;
|
||||
anonymousId?: string | number;
|
||||
integrations?: Integrations;
|
||||
}, callback?: (err: Error, data: Data) => void): Analytics;
|
||||
|
||||
/* Group calls can be used to associate individual users with shared
|
||||
accounts or companies. */
|
||||
group(message: {
|
||||
userId: string | number;
|
||||
userId?: string | number;
|
||||
anonymousId?: string | number;
|
||||
groupId: string | number;
|
||||
traits?: Object;
|
||||
context?: Object;
|
||||
timestamp?: Date;
|
||||
anonymous_id?: string | number;
|
||||
integrations?: Integrations;
|
||||
}, callback?: (err: Error, data: Data) => void): Analytics;
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"whitespace": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"whitespace": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+4
@@ -153,6 +153,10 @@ declare module 'angular' {
|
||||
defaultFontSet(name: string): IIconProvider;
|
||||
}
|
||||
|
||||
interface IInkRippleProvider {
|
||||
disableInkRipple(): void;
|
||||
}
|
||||
|
||||
type IMedia = (media: string) => boolean;
|
||||
|
||||
interface ISidenavObject {
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"whitespace": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"whitespace": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1502,16 +1502,28 @@ interface MyScope extends ng.IScope {
|
||||
foo: string;
|
||||
}
|
||||
|
||||
const directiveCompileFnWithGeneric: ng.IDirectiveCompileFn<MyScope> = (
|
||||
templateElement: JQLite,
|
||||
templateAttributes: ng.IAttributes,
|
||||
transclude: ng.ITranscludeFunction
|
||||
): ng.IDirectiveLinkFn<MyScope> => {
|
||||
return (
|
||||
scope: MyScope,
|
||||
instanceElement: JQLite,
|
||||
instanceAttributes: ng.IAttributes
|
||||
) => {
|
||||
return null;
|
||||
};
|
||||
};
|
||||
interface MyElement extends JQLite {
|
||||
foo: string;
|
||||
}
|
||||
|
||||
interface MyAttributes extends ng.IAttributes {
|
||||
foo: string;
|
||||
}
|
||||
interface MyController extends ng.INgModelController {
|
||||
foo: string;
|
||||
}
|
||||
|
||||
angular.module('WithGenerics', [])
|
||||
.directive('directiveUsingGenerics', () => {
|
||||
return {
|
||||
restrict: 'E',
|
||||
link(scope: MyScope, element: MyElement, templateAttributes: MyAttributes, controller: MyController) {
|
||||
scope['name'] = 'Jeff';
|
||||
}
|
||||
};
|
||||
})
|
||||
.directive('linkFunctionUsingGenerics', () => {
|
||||
return (scope: MyScope, element: MyElement, templateAttributes: MyAttributes, controller: MyController) => {
|
||||
scope['name'] = 'Jeff';
|
||||
};
|
||||
});
|
||||
|
||||
Vendored
+25
-22
@@ -240,8 +240,9 @@ declare namespace angular {
|
||||
* @param name Name of the directive in camel-case (i.e. ngBind which will match as ng-bind)
|
||||
* @param directiveFactory An injectable directive factory function.
|
||||
*/
|
||||
directive<TScope extends IScope = IScope>(name: string, directiveFactory: Injectable<IDirectiveFactory<TScope>>): IModule;
|
||||
directive<TScope extends IScope = IScope>(object: {[directiveName: string]: Injectable<IDirectiveFactory<TScope>>}): IModule;
|
||||
directive<TScope extends IScope = IScope, TElement extends JQLite = JQLite, TAttributes extends IAttributes = IAttributes, TController extends IDirectiveController = IController>(name: string, directiveFactory: Injectable<IDirectiveFactory<TScope, TElement, TAttributes, TController>>): IModule;
|
||||
directive<TScope extends IScope = IScope, TElement extends JQLite = JQLite, TAttributes extends IAttributes = IAttributes, TController extends IDirectiveController = IController>(object: {[directiveName: string]: Injectable<IDirectiveFactory<TScope, TElement, TAttributes, TController>>}): IModule;
|
||||
|
||||
/**
|
||||
* Register a service factory, which will be called to return the service instance. This is short for registering a service where its provider consists of only a $get property, which is the given service factory function. You should use $provide.factory(getFn) if you do not need to configure your service in a provider.
|
||||
*
|
||||
@@ -1346,8 +1347,8 @@ declare namespace angular {
|
||||
}
|
||||
|
||||
interface ICompileProvider extends IServiceProvider {
|
||||
directive<TScope extends IScope = IScope>(name: string, directiveFactory: Injectable<IDirectiveFactory<TScope>>): ICompileProvider;
|
||||
directive<TScope extends IScope = IScope>(object: {[directiveName: string]: Injectable<IDirectiveFactory<TScope>>}): ICompileProvider;
|
||||
directive<TScope extends IScope = IScope, TElement extends JQLite = JQLite, TAttributes extends IAttributes = IAttributes, TController extends IDirectiveController = IController>(name: string, directiveFactory: Injectable<IDirectiveFactory<TScope, TElement, TAttributes, TController>>): ICompileProvider;
|
||||
directive<TScope extends IScope = IScope, TElement extends JQLite = JQLite, TAttributes extends IAttributes = IAttributes, TController extends IDirectiveController = IController>(object: {[directiveName: string]: Injectable<IDirectiveFactory<TScope, TElement, TAttributes, TController>>}): ICompileProvider;
|
||||
|
||||
component(name: string, options: IComponentOptions): ICompileProvider;
|
||||
component(object: {[componentName: string]: IComponentOptions}): ICompileProvider;
|
||||
@@ -2066,29 +2067,31 @@ declare namespace angular {
|
||||
// and http://docs.angularjs.org/guide/directive
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
interface IDirectiveFactory<TScope extends IScope = IScope> {
|
||||
(...args: any[]): IDirective<TScope> | IDirectiveLinkFn<TScope>;
|
||||
type IDirectiveController = IController | IController[] | {[key: string]: IController};
|
||||
|
||||
interface IDirectiveFactory<TScope extends IScope = IScope, TElement extends JQLite = JQLite, TAttributes extends IAttributes = IAttributes, TController extends IDirectiveController = IController> {
|
||||
(...args: any[]): IDirective<TScope, TElement, TAttributes, TController> | IDirectiveLinkFn<TScope, TElement, TAttributes, TController>;
|
||||
}
|
||||
|
||||
interface IDirectiveLinkFn<TScope extends IScope = IScope> {
|
||||
interface IDirectiveLinkFn<TScope extends IScope = IScope, TElement extends JQLite = JQLite, TAttributes extends IAttributes = IAttributes, TController extends IDirectiveController = IController> {
|
||||
(
|
||||
scope: TScope,
|
||||
instanceElement: JQLite,
|
||||
instanceAttributes: IAttributes,
|
||||
controller?: IController | IController[] | {[key: string]: IController},
|
||||
instanceElement: TElement,
|
||||
instanceAttributes: TAttributes,
|
||||
controller?: TController,
|
||||
transclude?: ITranscludeFunction
|
||||
): void;
|
||||
}
|
||||
|
||||
interface IDirectivePrePost<TScope extends IScope = IScope> {
|
||||
pre?: IDirectiveLinkFn<TScope>;
|
||||
post?: IDirectiveLinkFn<TScope>;
|
||||
interface IDirectivePrePost<TScope extends IScope = IScope, TElement extends JQLite = JQLite, TAttributes extends IAttributes = IAttributes, TController extends IDirectiveController = IController> {
|
||||
pre?: IDirectiveLinkFn<TScope, TElement, TAttributes, TController>;
|
||||
post?: IDirectiveLinkFn<TScope, TElement, TAttributes, TController>;
|
||||
}
|
||||
|
||||
interface IDirectiveCompileFn<TScope extends IScope = IScope> {
|
||||
interface IDirectiveCompileFn<TScope extends IScope = IScope, TElement extends JQLite = JQLite, TAttributes extends IAttributes = IAttributes, TController extends IDirectiveController = IController> {
|
||||
(
|
||||
templateElement: JQLite,
|
||||
templateAttributes: IAttributes,
|
||||
templateElement: TElement,
|
||||
templateAttributes: TAttributes,
|
||||
/**
|
||||
* @deprecated
|
||||
* Note: The transclude function that is passed to the compile function is deprecated,
|
||||
@@ -2096,11 +2099,11 @@ declare namespace angular {
|
||||
* that is passed to the link function instead.
|
||||
*/
|
||||
transclude: ITranscludeFunction
|
||||
): void | IDirectiveLinkFn<TScope> | IDirectivePrePost<TScope>;
|
||||
): void | IDirectiveLinkFn<TScope, TElement, TAttributes, TController> | IDirectivePrePost<TScope, TElement, TAttributes, TController>;
|
||||
}
|
||||
|
||||
interface IDirective<TScope extends IScope = IScope> {
|
||||
compile?: IDirectiveCompileFn<TScope>;
|
||||
interface IDirective<TScope extends IScope = IScope, TElement extends JQLite = JQLite, TAttributes extends IAttributes = IAttributes, TController extends IDirectiveController = IController> {
|
||||
compile?: IDirectiveCompileFn<TScope, TElement, TAttributes, TController>;
|
||||
controller?: string | Injectable<IControllerConstructor>;
|
||||
controllerAs?: string;
|
||||
/**
|
||||
@@ -2109,7 +2112,7 @@ declare namespace angular {
|
||||
* relies upon bindings inside a $onInit method on the controller, instead.
|
||||
*/
|
||||
bindToController?: boolean | {[boundProperty: string]: string};
|
||||
link?: IDirectiveLinkFn<TScope> | IDirectivePrePost<TScope>;
|
||||
link?: IDirectiveLinkFn<TScope, TElement, TAttributes, TController> | IDirectivePrePost<TScope, TElement, TAttributes, TController>;
|
||||
multiElement?: boolean;
|
||||
priority?: number;
|
||||
/**
|
||||
@@ -2119,9 +2122,9 @@ declare namespace angular {
|
||||
require?: string | string[] | {[controller: string]: string};
|
||||
restrict?: string;
|
||||
scope?: boolean | {[boundProperty: string]: string};
|
||||
template?: string | ((tElement: JQLite, tAttrs: IAttributes) => string);
|
||||
template?: string | ((tElement: TElement, tAttrs: TAttributes) => string);
|
||||
templateNamespace?: string;
|
||||
templateUrl?: string | ((tElement: JQLite, tAttrs: IAttributes) => string);
|
||||
templateUrl?: string | ((tElement: TElement, tAttrs: TAttributes) => string);
|
||||
terminal?: boolean;
|
||||
transclude?: boolean | 'element' | {[slot: string]: string};
|
||||
}
|
||||
|
||||
Vendored
+6
-2
@@ -774,6 +774,7 @@ interface BaseJQueryEventObject extends Event {
|
||||
pageY: number;
|
||||
/**
|
||||
* For key or mouse events, this property indicates the specific key or button that was pressed.
|
||||
* @deprecated Use `key` for KeyEvents or `button` for MouseEvents instead.
|
||||
* @see {@link https://api.jquery.com/event.which/}
|
||||
*/
|
||||
which: number;
|
||||
@@ -804,9 +805,12 @@ interface JQueryMouseEventObject extends JQueryInputEventObject {
|
||||
}
|
||||
|
||||
interface JQueryKeyEventObject extends JQueryInputEventObject {
|
||||
char: any;
|
||||
/** @deprecated */
|
||||
char: string;
|
||||
/** @deprecated */
|
||||
charCode: number;
|
||||
key: any;
|
||||
key: string;
|
||||
/** @deprecated */
|
||||
keyCode: number;
|
||||
}
|
||||
|
||||
|
||||
@@ -94,8 +94,6 @@ function JQuery() {
|
||||
}
|
||||
|
||||
function bind() {
|
||||
interface I1 { kind: 'I1'; }
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind('myEvent', 'myData', function(event) {
|
||||
// TODO: $ExpectType HTMLElement
|
||||
@@ -104,14 +102,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind('myEvent', 'myData', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind('myEvent', function(event) {
|
||||
// TODO: $ExpectType HTMLElement
|
||||
@@ -120,14 +110,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind('myEvent', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind('myEvent', false);
|
||||
|
||||
@@ -139,12 +121,6 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -164,27 +140,15 @@ function JQuery() {
|
||||
}
|
||||
|
||||
function off() {
|
||||
function defaultContext_defaultData(this: HTMLElement, event: JQueryEventObject) { }
|
||||
function defaultData(this: HTMLElement, event: JQueryEventObject) { }
|
||||
|
||||
function defaultContext_customData(this: HTMLElement, event: JQueryEventObject) { }
|
||||
|
||||
function customContext_defaultData(this: I1, event: JQueryEventObject) { }
|
||||
|
||||
function customContext_customData(this: I1, event: JQueryEventObject) { }
|
||||
|
||||
interface I1 { kind: 'I1'; }
|
||||
function customData(this: HTMLElement, event: JQueryEventObject) { }
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', 'td', defaultContext_defaultData);
|
||||
$('table').off('myEvent', 'td', defaultData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', 'td', defaultContext_customData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', 'td', customContext_defaultData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', 'td', customContext_customData);
|
||||
$('table').off('myEvent', 'td', customData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', 'td', false);
|
||||
@@ -193,16 +157,10 @@ function JQuery() {
|
||||
$('table').off('myEvent', 'td');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', defaultContext_defaultData);
|
||||
$('table').off('myEvent', defaultData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', defaultContext_customData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', customContext_defaultData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', customContext_customData);
|
||||
$('table').off('myEvent', customData);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', false);
|
||||
@@ -213,19 +171,15 @@ function JQuery() {
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off({
|
||||
myEvent1: false,
|
||||
defaultContext_defaultData,
|
||||
defaultContext_customData,
|
||||
customContext_defaultData,
|
||||
customContext_customData
|
||||
defaultData,
|
||||
customData
|
||||
}, 'td');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off({
|
||||
myEvent1: false,
|
||||
defaultContext_defaultData,
|
||||
defaultContext_customData,
|
||||
customContext_defaultData,
|
||||
customContext_customData
|
||||
defaultData,
|
||||
customData
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
@@ -236,8 +190,6 @@ function JQuery() {
|
||||
}
|
||||
|
||||
function on() {
|
||||
interface I1 { kind: 'I1'; }
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', 'myData', function(event) {
|
||||
// TODO: $ExpectType HTMLElement
|
||||
@@ -246,14 +198,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', 'myData', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', null, 'myData', function(event) {
|
||||
// TODO: $ExpectType HTMLElement
|
||||
@@ -262,14 +206,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', null, 'myData', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', function(event) {
|
||||
// TODO: $ExpectType HTMLElement
|
||||
@@ -278,14 +214,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', false);
|
||||
|
||||
@@ -297,14 +225,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 3, function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', function(event) {
|
||||
// TODO: $ExpectType HTMLElement
|
||||
@@ -313,14 +233,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', false);
|
||||
|
||||
@@ -332,12 +244,6 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
}
|
||||
}, 'td', 'myData');
|
||||
|
||||
@@ -349,12 +255,6 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
}
|
||||
}, null, 'myData');
|
||||
|
||||
@@ -366,12 +266,6 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
}
|
||||
}, 'td');
|
||||
|
||||
@@ -383,12 +277,6 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
}
|
||||
}, 3);
|
||||
|
||||
@@ -400,19 +288,11 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function one() {
|
||||
interface I1 { kind: 'I1'; }
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 'td', 'myData', function(event) {
|
||||
// TODO: $ExpectType HTMLElement
|
||||
@@ -421,14 +301,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 'td', 'myData', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', null, 'myData', function(event) {
|
||||
// TODO: $ExpectType HTMLElement
|
||||
@@ -437,14 +309,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', null, 'myData', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 'td', function(event) {
|
||||
// TODO: $ExpectType HTMLElement
|
||||
@@ -453,14 +317,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 'td', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 'td', false);
|
||||
|
||||
@@ -472,14 +328,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 3, function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', function(event) {
|
||||
// TODO: $ExpectType HTMLElement
|
||||
@@ -488,14 +336,6 @@ function JQuery() {
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', function(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', false);
|
||||
|
||||
@@ -507,12 +347,6 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
}
|
||||
}, 'td', 'myData');
|
||||
|
||||
@@ -524,12 +358,6 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
}
|
||||
}, null, 'myData');
|
||||
|
||||
@@ -541,12 +369,6 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
}
|
||||
}, 'td');
|
||||
|
||||
@@ -558,12 +380,6 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
}
|
||||
}, 3);
|
||||
|
||||
@@ -575,12 +391,6 @@ function JQuery() {
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent3(this: I1, event) {
|
||||
// $ExpectType I1
|
||||
this;
|
||||
// TODO: $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
"whitespace": false,
|
||||
"no-angle-bracket-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,30 +1,35 @@
|
||||
import * as colors from 'ansi-colors';
|
||||
import colors = require('ansi-colors');
|
||||
|
||||
let s: string;
|
||||
colors.red('This is a red string!'); // $ExpectType string
|
||||
colors.green('This is a red string!'); // $ExpectType string
|
||||
colors.cyan('This is a cyan string!'); // $ExpectType string
|
||||
colors.yellow('This is a yellow string!'); // $ExpectType string
|
||||
|
||||
s = colors.bgblack("hello");
|
||||
s = colors.bgblue("hello");
|
||||
s = colors.bgcyan("hello");
|
||||
s = colors.bggreen("hello");
|
||||
s = colors.bgmagenta("hello");
|
||||
s = colors.bgred("hello");
|
||||
s = colors.bgwhite("hello");
|
||||
s = colors.bgyellow("hello");
|
||||
s = colors.black("hello");
|
||||
s = colors.blue("hello");
|
||||
s = colors.bold("hello");
|
||||
s = colors.cyan("hello");
|
||||
s = colors.dim("hello");
|
||||
s = colors.gray("hello");
|
||||
s = colors.green("hello");
|
||||
s = colors.grey("hello");
|
||||
s = colors.hidden("hello");
|
||||
s = colors.inverse("hello");
|
||||
s = colors.italic("hello");
|
||||
s = colors.magenta("hello");
|
||||
s = colors.red("hello");
|
||||
s = colors.reset("hello");
|
||||
s = colors.strikethrough("hello");
|
||||
s = colors.underline("hello");
|
||||
s = colors.white("hello");
|
||||
s = colors.yellow("hello");
|
||||
colors.bold.red('this is a bold red message'); // $ExpectType string
|
||||
colors.bold.yellow.italic('this is a bold yellow italicized message'); // $ExpectType string
|
||||
colors.green.bold.underline('this is a bold green underlined message'); // $ExpectType string
|
||||
|
||||
colors.yellow(`foo ${colors.red.bold('red')} bar ${colors.cyan('cyan')} baz`); // $ExpectType string
|
||||
colors.bold(`foo ${colors.red.dim('bar')} baz`); // $ExpectType string
|
||||
|
||||
colors.enabled = false;
|
||||
colors.visible = false;
|
||||
|
||||
colors.hasAnsi(colors.blue('foo')); // $ExpectType boolean
|
||||
colors.hasColor(colors.blue('foo')); // $ExpectType boolean
|
||||
|
||||
colors.unstyle(colors.blue.bold('foo bar baz')); // $ExpectType string
|
||||
colors.stripColor(colors.blue.bold('foo bar baz')); // $ExpectType string
|
||||
|
||||
colors.none('foo'); // $ExpectType string
|
||||
colors.clear('foo'); // $ExpectType string
|
||||
colors.noop('foo'); // $ExpectType string
|
||||
|
||||
colors.define('reset', [0, 0], 'modifier');
|
||||
|
||||
colors.symbols.ballotCross; // $ExpectType string | undefined
|
||||
colors.symbols.windows.ballotCross; // $ExpectError
|
||||
colors.symbols.other.ballotCross; // $ExpectType string
|
||||
colors.symbols.cross; // $ExpectType string
|
||||
colors.symbols.windows.cross; // $ExpectType string
|
||||
colors.symbols.other.cross; // $ExpectType string
|
||||
|
||||
Vendored
+107
-27
@@ -1,31 +1,111 @@
|
||||
// Type definitions for ansi-colors 1.0
|
||||
// Type definitions for ansi-colors 3.2
|
||||
// Project: https://github.com/doowb/ansi-colors
|
||||
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>
|
||||
// BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
export function bgblack(s: string): string;
|
||||
export function bgblue(s: string): string;
|
||||
export function bgcyan(s: string): string;
|
||||
export function bggreen(s: string): string;
|
||||
export function bgmagenta(s: string): string;
|
||||
export function bgred(s: string): string;
|
||||
export function bgwhite(s: string): string;
|
||||
export function bgyellow(s: string): string;
|
||||
export function black(s: string): string;
|
||||
export function blue(s: string): string;
|
||||
export function bold(s: string): string;
|
||||
export function cyan(s: string): string;
|
||||
export function dim(s: string): string;
|
||||
export function gray(s: string): string;
|
||||
export function green(s: string): string;
|
||||
export function grey(s: string): string;
|
||||
export function hidden(s: string): string;
|
||||
export function inverse(s: string): string;
|
||||
export function italic(s: string): string;
|
||||
export function magenta(s: string): string;
|
||||
export function red(s: string): string;
|
||||
export function reset(s: string): string;
|
||||
export function strikethrough(s: string): string;
|
||||
export function underline(s: string): string;
|
||||
export function white(s: string): string;
|
||||
export function yellow(s: string): string;
|
||||
export = colors;
|
||||
|
||||
declare const colors: colors.Colors;
|
||||
|
||||
declare namespace colors {
|
||||
type ColorFn = ((text: string) => string) & Colors;
|
||||
|
||||
interface Colors {
|
||||
enabled: boolean;
|
||||
visible: boolean;
|
||||
|
||||
reset: ColorFn;
|
||||
bold: ColorFn;
|
||||
dim: ColorFn;
|
||||
italic: ColorFn;
|
||||
underline: ColorFn;
|
||||
inverse: ColorFn;
|
||||
hidden: ColorFn;
|
||||
strikethrough: ColorFn;
|
||||
|
||||
black: ColorFn;
|
||||
red: ColorFn;
|
||||
green: ColorFn;
|
||||
yellow: ColorFn;
|
||||
blue: ColorFn;
|
||||
magenta: ColorFn;
|
||||
cyan: ColorFn;
|
||||
white: ColorFn;
|
||||
gray: ColorFn;
|
||||
grey: ColorFn;
|
||||
|
||||
bgBlack: ColorFn;
|
||||
bgRed: ColorFn;
|
||||
bgGreen: ColorFn;
|
||||
bgYellow: ColorFn;
|
||||
bgBlue: ColorFn;
|
||||
bgMagenta: ColorFn;
|
||||
bgCyan: ColorFn;
|
||||
bgWhite: ColorFn;
|
||||
|
||||
blackBright: ColorFn;
|
||||
redBright: ColorFn;
|
||||
greenBright: ColorFn;
|
||||
yellowBright: ColorFn;
|
||||
blueBright: ColorFn;
|
||||
magentaBright: ColorFn;
|
||||
cyanBright: ColorFn;
|
||||
whiteBright: ColorFn;
|
||||
|
||||
bgBlackBright: ColorFn;
|
||||
bgRedBright: ColorFn;
|
||||
bgGreenBright: ColorFn;
|
||||
bgYellowBright: ColorFn;
|
||||
bgBlueBright: ColorFn;
|
||||
bgMagentaBright: ColorFn;
|
||||
bgCyanBright: ColorFn;
|
||||
bgWhiteBright: ColorFn;
|
||||
|
||||
hasColor(text: string): boolean;
|
||||
hasAnsi(text: string): boolean;
|
||||
unstyle(text: string): string;
|
||||
stripColor(text: string): string;
|
||||
none(text: string): string;
|
||||
clear(text: string): string;
|
||||
noop(text: string): string;
|
||||
|
||||
symbols: Symbols & {
|
||||
windows: WindowsSymbols;
|
||||
other: OtherPlatformsSymbols;
|
||||
};
|
||||
|
||||
define(
|
||||
name: string,
|
||||
codes: [number, number],
|
||||
type: 'modifier' | 'color' | 'bg' | 'bright' | 'bgBright'
|
||||
): void;
|
||||
}
|
||||
|
||||
interface WindowsSymbols {
|
||||
bullet: string;
|
||||
check: string;
|
||||
cross: string;
|
||||
ellipsis: string;
|
||||
heart: string;
|
||||
info: string;
|
||||
line: string;
|
||||
middot: string;
|
||||
minus: string;
|
||||
plus: string;
|
||||
question: string;
|
||||
questionSmall: string;
|
||||
pointer: string;
|
||||
pointerSmall: string;
|
||||
warning: string;
|
||||
}
|
||||
|
||||
interface ExtendedSymbols {
|
||||
ballotCross: string;
|
||||
questionFull: string;
|
||||
}
|
||||
|
||||
type Symbols = WindowsSymbols & Partial<ExtendedSymbols>;
|
||||
type OtherPlatformsSymbols = WindowsSymbols & ExtendedSymbols;
|
||||
}
|
||||
|
||||
@@ -20,4 +20,4 @@
|
||||
"index.d.ts",
|
||||
"ansi-colors-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import * as colors from 'ansi-colors';
|
||||
|
||||
let s: string;
|
||||
|
||||
s = colors.bgblack("hello");
|
||||
s = colors.bgblue("hello");
|
||||
s = colors.bgcyan("hello");
|
||||
s = colors.bggreen("hello");
|
||||
s = colors.bgmagenta("hello");
|
||||
s = colors.bgred("hello");
|
||||
s = colors.bgwhite("hello");
|
||||
s = colors.bgyellow("hello");
|
||||
s = colors.black("hello");
|
||||
s = colors.blue("hello");
|
||||
s = colors.bold("hello");
|
||||
s = colors.cyan("hello");
|
||||
s = colors.dim("hello");
|
||||
s = colors.gray("hello");
|
||||
s = colors.green("hello");
|
||||
s = colors.grey("hello");
|
||||
s = colors.hidden("hello");
|
||||
s = colors.inverse("hello");
|
||||
s = colors.italic("hello");
|
||||
s = colors.magenta("hello");
|
||||
s = colors.red("hello");
|
||||
s = colors.reset("hello");
|
||||
s = colors.strikethrough("hello");
|
||||
s = colors.underline("hello");
|
||||
s = colors.white("hello");
|
||||
s = colors.yellow("hello");
|
||||
Vendored
+31
@@ -0,0 +1,31 @@
|
||||
// Type definitions for ansi-colors 1.0
|
||||
// Project: https://github.com/doowb/ansi-colors
|
||||
// Definitions by: Rogier Schouten <https://github.com/rogierschouten>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export function bgblack(s: string): string;
|
||||
export function bgblue(s: string): string;
|
||||
export function bgcyan(s: string): string;
|
||||
export function bggreen(s: string): string;
|
||||
export function bgmagenta(s: string): string;
|
||||
export function bgred(s: string): string;
|
||||
export function bgwhite(s: string): string;
|
||||
export function bgyellow(s: string): string;
|
||||
export function black(s: string): string;
|
||||
export function blue(s: string): string;
|
||||
export function bold(s: string): string;
|
||||
export function cyan(s: string): string;
|
||||
export function dim(s: string): string;
|
||||
export function gray(s: string): string;
|
||||
export function green(s: string): string;
|
||||
export function grey(s: string): string;
|
||||
export function hidden(s: string): string;
|
||||
export function inverse(s: string): string;
|
||||
export function italic(s: string): string;
|
||||
export function magenta(s: string): string;
|
||||
export function red(s: string): string;
|
||||
export function reset(s: string): string;
|
||||
export function strikethrough(s: string): string;
|
||||
export function underline(s: string): string;
|
||||
export function white(s: string): string;
|
||||
export function yellow(s: string): string;
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"paths": {
|
||||
"ansi-colors": [
|
||||
"ansi-colors/v1"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ansi-colors-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -9,5 +9,8 @@ ansiRegex().test('\u001B[4mcake\u001B[0m'); // $ExpectType boolean
|
||||
ansiRegex().test('cake'); // $ExpectType boolean
|
||||
// => false
|
||||
|
||||
ansiRegex({onlyFirst: true}).test('cake'); // $ExpectType boolean
|
||||
// => false
|
||||
|
||||
'\u001B[4mcake\u001B[0m'.match(ansiRegex()); // $ExpectType RegExpMatchArray | null
|
||||
// => ['\u001B[4m', '\u001B[0m']
|
||||
|
||||
Vendored
+12
-3
@@ -1,7 +1,16 @@
|
||||
// Type definitions for ansi-regex 3.0
|
||||
// Type definitions for ansi-regex 4.0
|
||||
// Project: https://github.com/chalk/ansi-regex#readme
|
||||
// Definitions by: Manish Vachharajani <https://github.com/mvachhar>
|
||||
// Florian Keller <https://github.com/ffflorian>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare function r(): RegExp;
|
||||
export = r;
|
||||
declare namespace ansiRegex {
|
||||
interface Options {
|
||||
/** Match only the first ANSI escape. */
|
||||
onlyFirst?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare function ansiRegex(options?: ansiRegex.Options): RegExp;
|
||||
|
||||
export = ansiRegex;
|
||||
|
||||
@@ -22,7 +22,7 @@ Object.keys({
|
||||
}).forEach((color) => {
|
||||
const cname = color.replace(/([a-z])([A-Z])/g, (_: string, l: string, u: string): string => `${l} ${u.toLowerCase()}`);
|
||||
|
||||
((<(...anything: any[]) => ansi.Cursor> cursor[color])()
|
||||
((cursor[color] as (...anything: any[]) => ansi.Cursor)()
|
||||
.bold()
|
||||
.bg)[color === 'blue' || color === 'brightBlue' ? 'black' : 'blue']()
|
||||
.write(
|
||||
|
||||
Vendored
+41
-4
@@ -1,8 +1,45 @@
|
||||
// Type definitions for ansicolors
|
||||
// Project: https://github.com/thlorenz/ansicolors
|
||||
// Definitions by: rogierschouten <https://github.com/rogierschouten>
|
||||
// Definitions by: Benjamin Arthur Lupton <https://github.com/balupton>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
declare var colors: { [index: string]: (s: string) => string; };
|
||||
export = colors;
|
||||
interface Colors extends String {
|
||||
(value: string): string
|
||||
white: this
|
||||
black: this
|
||||
blue: this
|
||||
cyan: this
|
||||
green: this
|
||||
magenta: this
|
||||
red: this
|
||||
yellow: this
|
||||
brightBlack: this
|
||||
brightRed: this
|
||||
brightGreen: this
|
||||
brightYellow: this
|
||||
brightBlue: this
|
||||
brightMagenta: this
|
||||
brightCyan: this
|
||||
brightWhite: this
|
||||
bgBlack: this
|
||||
bgRed: this
|
||||
bgGreen: this
|
||||
bgYellow: this
|
||||
bgBlue: this
|
||||
bgMagenta: this
|
||||
bgCyan: this
|
||||
bgWhite: this
|
||||
bgBrightBlack: this
|
||||
bgBrightRed: this
|
||||
bgBrightGreen: this
|
||||
bgBrightYellow: this
|
||||
bgBrightBlue: this
|
||||
bgBrightMagenta: this
|
||||
bgBrightCyan: this
|
||||
bgBrightWhite: this
|
||||
open: this
|
||||
close: this
|
||||
colors: this
|
||||
}
|
||||
declare const colors: Colors
|
||||
export default colors
|
||||
|
||||
@@ -47,7 +47,8 @@ appInsights = {
|
||||
startTrackEvent(name: string) { return null; },
|
||||
stopTrackEvent(name: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }) { return null; },
|
||||
trackEvent(name: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }) { return null; },
|
||||
trackDependency(id: string, method: string, absoluteUrl: string, pathName: string, totalTime: number, success: boolean, resultCode: number) { return null; },
|
||||
trackDependency(id: string, method: string, absoluteUrl: string, pathName: string, totalTime: number, success: boolean,
|
||||
resultCode: number, properties?: { [name: string]: string }, measurements?: { [name: string]: number }) { return null; },
|
||||
trackException(exception: Error, handledAt?: string, properties?: { [name: string]: string; }, measurements?: { [name: string]: number; }, severityLevel?: AI.SeverityLevel) { return null; },
|
||||
trackMetric(name: string, average: number, sampleCount?: number, min?: number, max?: number, properties?: { [name: string]: string; }) { return null; },
|
||||
trackTrace(message: string, properties?: { [name: string]: string; }, severityLevel?: AI.SeverityLevel) { return null; },
|
||||
@@ -86,7 +87,7 @@ appInsights.trackTrace("message", null);
|
||||
appInsights.trackTrace("message", { a: '1', b: '2' }, AI.SeverityLevel.Error);
|
||||
|
||||
// trackDependency
|
||||
appInsights.trackDependency("id", "POST", "http://example.com/test/abc", "/test/abc", null, true, null);
|
||||
appInsights.trackDependency("id", "POST", "http://example.com/test/abc", "/test/abc", null, true, null, {prop1: 'abc'}, {meas1: 4.5});
|
||||
|
||||
// flush
|
||||
appInsights.flush();
|
||||
|
||||
+14
-9
@@ -670,14 +670,16 @@ declare module Microsoft.ApplicationInsights {
|
||||
context: ITelemetryContext;
|
||||
queue: Array<() => void>;
|
||||
/**
|
||||
* Starts timing how long the user views a page or other item. Call this when the page opens.
|
||||
* This method doesn't send any telemetry. Call {@link stopTrackTelemetry} to log the page when it closes.
|
||||
* Starts the timer for tracking a page load time. Use this instead of `trackPageView` if you want to control when the page view timer starts and stops,
|
||||
* but don't want to calculate the duration yourself. This method doesn't send any telemetry. Call `stopTrackPage` to log the end of the page view
|
||||
* and send the event.
|
||||
* @param name A string that idenfities this item, unique within this HTML document. Defaults to the document title.
|
||||
*/
|
||||
startTrackPage(name?: string): any;
|
||||
/**
|
||||
* Logs how long a page or other item was visible, after {@link startTrackPage}. Call this when the page closes.
|
||||
* @param name The string you used as the name in startTrackPage. Defaults to the document title.
|
||||
* Stops the timer that was started by calling `startTrackPage` and sends the pageview load time telemetry with the specified properties and measurements.
|
||||
* The duration of the page view will be the time between calling `startTrackPage` and `stopTrackPage`.
|
||||
* @param name The string you used as the name in `startTrackPage`. Defaults to the document title.
|
||||
* @param url String - a relative or absolute URL that identifies the page or other item. Defaults to the window location.
|
||||
* @param properties map[string, string] - additional data used to filter pages and metrics in the portal. Defaults to empty.
|
||||
* @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.
|
||||
@@ -689,7 +691,7 @@ declare module Microsoft.ApplicationInsights {
|
||||
measurements?: { [name: string]: number }): any;
|
||||
/**
|
||||
* Logs that a page or other item was viewed.
|
||||
* @param name The string you used as the name in startTrackPage. Defaults to the document title.
|
||||
* @param name The string you used as the name in `startTrackPage`. Defaults to the document title.
|
||||
* @param url String - a relative or absolute URL that identifies the page or other item. Defaults to the window location.
|
||||
* @param properties map[string, string] - additional data used to filter pages and metrics in the portal. Defaults to empty.
|
||||
* @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.
|
||||
@@ -701,13 +703,13 @@ declare module Microsoft.ApplicationInsights {
|
||||
properties?: { [name: string]: string },
|
||||
measurements?: { [name: string]: number }, duration?: number): any;
|
||||
/**
|
||||
* Start timing an extended event. Call {@link stopTrackEvent} to log the event when it ends.
|
||||
* Start timing an extended event. Call `stopTrackEvent` to log the event when it ends.
|
||||
* @param name A string that identifies this event uniquely within the document.
|
||||
*/
|
||||
startTrackEvent(name: string): any;
|
||||
/**
|
||||
* Log an extended event that you started timing with {@link startTrackEvent}.
|
||||
* @param name The string you used to identify this event in startTrackEvent.
|
||||
* Log an extended event that you started timing with `startTrackEvent`.
|
||||
* @param name The string you used to identify this event in `startTrackEvent`.
|
||||
* @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
|
||||
* @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
|
||||
*/
|
||||
@@ -734,8 +736,11 @@ declare module Microsoft.ApplicationInsights {
|
||||
* @param totalTime total request time
|
||||
* @param success indicates if the request was sessessful
|
||||
* @param resultCode response code returned by the dependency request
|
||||
* @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
|
||||
* @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
|
||||
*/
|
||||
trackDependency(id: string, method: string, absoluteUrl: string, pathName: string, totalTime: number, success: boolean, resultCode: number): any;
|
||||
trackDependency(id: string, method: string, absoluteUrl: string, pathName: string, totalTime: number, success: boolean, resultCode: number,
|
||||
properties?: { [name: string]: string }, measurements?: { [name: string]: number }): any;
|
||||
/**
|
||||
* Log an exception you have caught.
|
||||
* @param exception An Error from a catch clause, or the string error message.
|
||||
|
||||
@@ -16,6 +16,9 @@ coll.save({ username: "user" });
|
||||
const doc = coll.any();
|
||||
console.log(doc.username);
|
||||
|
||||
const coll2 = db._collection(coll.name());
|
||||
console.log(coll2 === coll);
|
||||
|
||||
const users = coll as ArangoDB.Collection<User>;
|
||||
const admin = users.firstExample({ username: "admin" })!;
|
||||
users.update(admin, { password: md5("hunter2") });
|
||||
|
||||
Vendored
+2
-10
@@ -619,6 +619,7 @@ declare namespace ArangoDB {
|
||||
|
||||
interface Collection<T extends object = any> {
|
||||
// Collection
|
||||
name(): string;
|
||||
checksum(
|
||||
withRevisions?: boolean,
|
||||
withData?: boolean
|
||||
@@ -1503,16 +1504,7 @@ declare module "@arangodb/foxx/queues" {
|
||||
function deleteQueue(name: string): boolean;
|
||||
function get(name: string): Queue;
|
||||
|
||||
export {
|
||||
createQueue as create,
|
||||
deleteQueue as delete,
|
||||
get,
|
||||
JobOptions,
|
||||
Job,
|
||||
Queue,
|
||||
QueueItem,
|
||||
Script,
|
||||
};
|
||||
export { createQueue as create, deleteQueue as delete, get, JobOptions, Job, Queue, QueueItem, Script, };
|
||||
}
|
||||
|
||||
declare module "@arangodb/foxx/graphql" {
|
||||
|
||||
Vendored
+17547
-13504
File diff suppressed because it is too large
Load Diff
Vendored
+68
-6
@@ -1,4 +1,4 @@
|
||||
// Type definitions for ArcGIS API for JavaScript 3.26
|
||||
// Type definitions for ArcGIS API for JavaScript 3.27
|
||||
// Project: https://developers.arcgis.com/javascript/3/
|
||||
// Definitions by: Esri <https://github.com/Esri>
|
||||
// Bjorn Svensson <https://github.com/bsvensson>
|
||||
@@ -560,7 +560,7 @@ declare module "esri" {
|
||||
/** An array of driving time break values. */
|
||||
breakValues?: number[];
|
||||
/** The point feature layer around which drive-time areas will be drawn. */
|
||||
inputLayer: FeatureLayer;
|
||||
inputLayers: FeatureLayer[];
|
||||
/** The geometry type of the input layer. */
|
||||
inputType?: string;
|
||||
/** Reference to the map object. */
|
||||
@@ -1351,6 +1351,8 @@ declare module "esri" {
|
||||
clip?: number;
|
||||
/** If the widget is enabled and layers can be swiped. */
|
||||
enabled?: boolean;
|
||||
/** Indicates whether layer placement should be inverted (switched). */
|
||||
invertPlacement?: boolean;
|
||||
/** The layers to be swiped. */
|
||||
layers: Layer[];
|
||||
/** The number of pixels to place the tool from the left of the map. */
|
||||
@@ -2532,7 +2534,7 @@ declare module "esri/Credential" {
|
||||
class Credential {
|
||||
/** Token expiration time specified as number of milliseconds since 1 January 1970 00:00:00 UTC. */
|
||||
expires: number;
|
||||
/** Indicates whether this credential belongs to a user with admin privileges. */
|
||||
/** Indicates that this credential was created to access the ArcGIS REST Admin service */
|
||||
isAdmin: boolean;
|
||||
/** The Identity Manager's setOAuthRedirectionHandler returns an object that contains a "state" parameter. */
|
||||
oAuthState: any;
|
||||
@@ -2600,6 +2602,12 @@ declare module "esri/IdentityManagerBase" {
|
||||
tokenValidity: number;
|
||||
/** If your application is on the same domain as *.arcgis.com or ArcGIS Enterprise Server, the IdentityManager will redirect the user to its sign-in page. */
|
||||
useSignInPage: boolean;
|
||||
/**
|
||||
* Returns a Credential object if the user has already signed in to access the given resource and is allowed to do so when using the given application id.
|
||||
* @param resUrl The resource URL.
|
||||
* @param appId The registered OAuth application id.
|
||||
*/
|
||||
checkAppAccess(resUrl: string, appId: string): any;
|
||||
/**
|
||||
* Returns the credential (via Deferred) if the user has already signed in to access the given resource.
|
||||
* @param resUrl The resource URL.
|
||||
@@ -2891,7 +2899,7 @@ declare module "esri/SnappingManager" {
|
||||
}
|
||||
|
||||
declare module "esri/SpatialReference" {
|
||||
/** The spatial reference of a map, layer, or inputs to and outputs from a task. */
|
||||
/** Defines the spatial reference of a map, layer, or task parameters. */
|
||||
class SpatialReference {
|
||||
/** The well-known ID of a spatial reference. */
|
||||
wkid: number;
|
||||
@@ -2953,6 +2961,54 @@ declare module "esri/TimeExtent" {
|
||||
export = TimeExtent;
|
||||
}
|
||||
|
||||
declare module "esri/arcadeProfiles/fieldCalculateProfile" {
|
||||
/** Module that implements the Arcade field calculate profile in web apps that calculate field values using Arcade expressions. */
|
||||
var fieldCalculateProfile: {
|
||||
/**
|
||||
* Initializes the field calculate profile for the given Arcade expressions.
|
||||
* @param expressions An array of Arcade expressions intended for use in the calculate profile.
|
||||
*/
|
||||
initialize(expressions: string[]): any;
|
||||
};
|
||||
export = fieldCalculateProfile;
|
||||
}
|
||||
|
||||
declare module "esri/arcadeProfiles/labelingProfile" {
|
||||
/** Module that implements the Arcade labeling profile in web apps that label features using Arcade expressions. */
|
||||
var labelingProfile: {
|
||||
/**
|
||||
* Initializes the labeling profile for the given Arcade expressions.
|
||||
* @param expressions An array of Arcade expressions intended for use in a label class.
|
||||
*/
|
||||
initialize(expressions: string[]): any;
|
||||
};
|
||||
export = labelingProfile;
|
||||
}
|
||||
|
||||
declare module "esri/arcadeProfiles/popupProfile" {
|
||||
/** Module that implements the Arcade popup profile for web apps that contain popups that reference Arcade expressions. */
|
||||
var popupProfile: {
|
||||
/**
|
||||
* Initializes the popup profile for the given Arcade expressions.
|
||||
* @param expressions An array of Arcade expressions intended for use in a popup template.
|
||||
*/
|
||||
initialize(expressions: string[]): any;
|
||||
};
|
||||
export = popupProfile;
|
||||
}
|
||||
|
||||
declare module "esri/arcadeProfiles/visualizationProfile" {
|
||||
/** Module that implements the Arcade visualization profile in web apps that render features using Arcade expressions. */
|
||||
var visualizationProfile: {
|
||||
/**
|
||||
* Initializes the visualization profile for the given Arcade expressions.
|
||||
* @param expressions An array of Arcade expressions intended for use in a renderer.
|
||||
*/
|
||||
initialize(expressions: string[]): any;
|
||||
};
|
||||
export = visualizationProfile;
|
||||
}
|
||||
|
||||
declare module "esri/arcgis/OAuthInfo" {
|
||||
import esri = require("esri");
|
||||
|
||||
@@ -4827,6 +4883,8 @@ declare module "esri/dijit/LayerSwipe" {
|
||||
clip: number;
|
||||
/** If the widget is enabled and layers can be swiped. */
|
||||
enabled: boolean;
|
||||
/** Indicates whether layer placement should be inverted (switched). */
|
||||
invertPlacement: boolean;
|
||||
/** The layers to be swiped. */
|
||||
layers: Layer[];
|
||||
/** The number of pixels to place the tool from the left of the map. */
|
||||
@@ -6285,7 +6343,7 @@ declare module "esri/dijit/analysis/CreateDriveTimeAreas" {
|
||||
/** An array of driving time break values. */
|
||||
breakValues: number[];
|
||||
/** The point feature layer around which drive-time areas will be drawn. */
|
||||
inputLayer: FeatureLayer;
|
||||
inputLayers: FeatureLayer[];
|
||||
/** The geometry type of the input layer. */
|
||||
inputType: string;
|
||||
/** Reference to the map object. */
|
||||
@@ -9073,6 +9131,8 @@ declare module "esri/graphic" {
|
||||
getNode(): any;
|
||||
/** Returns one or more DOM nodes used to draw the graphic. */
|
||||
getNodes(): any;
|
||||
/** Applicable to label graphics. */
|
||||
getParentGraphic(): Graphic;
|
||||
/** Returns the dojox/gfx/shape.Shape of the Esri graphic. */
|
||||
getShape(): any;
|
||||
/** Returns one or more dojox/gfx/shape.Shape used to draw the graphic. */
|
||||
@@ -10314,6 +10374,8 @@ declare module "esri/layers/FeatureLayer" {
|
||||
on(type: "query-limit-exceeded", listener: (event: { target: FeatureLayer }) => void): esri.Handle;
|
||||
/** Fires when queryRelatedFeatures() is complete. */
|
||||
on(type: "query-related-features-complete", listener: (event: { relatedFeatures: any; target: FeatureLayer }) => void): esri.Handle;
|
||||
/** Fires right before the actual refresh kicks in for the layer, and only fires when the refresh is triggered by the refreshInterval. */
|
||||
on(type: "refresh-tick", listener: (event: { target: FeatureLayer }) => void): esri.Handle;
|
||||
/** Fires when a layer resumes drawing. */
|
||||
on(type: "resume", listener: (event: { target: FeatureLayer }) => void): esri.Handle;
|
||||
/** Fires when a layer's minScale and/or maxScale is changed. */
|
||||
@@ -12419,7 +12481,7 @@ declare module "esri/map" {
|
||||
getMinScale(): number;
|
||||
/** Returns the minimum zoom level of the map. */
|
||||
getMinZoom(): number;
|
||||
/** Returns the current map scale. */
|
||||
/** Returns the map scale at the center of the view. */
|
||||
getScale(): number;
|
||||
/** Returns the current zoom level of the map. */
|
||||
getZoom(): number;
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import diff = require('arr-diff');
|
||||
|
||||
const a = ['a', 'b', 'c', 'd'];
|
||||
const b = [1, 2];
|
||||
|
||||
diff(['a']); // $ExpectType string[]
|
||||
diff(['a'], [1]); // $ExpectType string[]
|
||||
diff([1], ['a']); // $ExpectType number[]
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
// Type definitions for arr-diff 4.0
|
||||
// Project: https://github.com/jonschlinkert/arr-diff
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = arrDiff;
|
||||
|
||||
declare function arrDiff<T>(first: T[], ...args: any[][]): T[];
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"arr-diff-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -5,6 +5,7 @@ assert(true, "it's working");
|
||||
assert.ok(true, "inner functions work as well");
|
||||
|
||||
assert.throws(() => {});
|
||||
assert.throws(() => {}, /Regex test/);
|
||||
assert.throws(() => {}, () => {}, "works wonderfully");
|
||||
|
||||
assert['fail'](true, true, "works like a charm");
|
||||
|
||||
Vendored
+3
-2
@@ -1,6 +1,7 @@
|
||||
// Type definitions for commonjs-assert 1.4
|
||||
// Project: https://github.com/browserify/commonjs-assert
|
||||
// Definitions by: Nico Gallinal <https://github.com/nicoabie>
|
||||
// Linus Unnebäck <https://github.com/LinusU>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare function assert(value: any, message?: string): void;
|
||||
@@ -23,10 +24,10 @@ declare namespace assert {
|
||||
function notStrictEqual(actual: any, expected: any, message?: string): void;
|
||||
|
||||
function throws(block: () => void, message?: string): void;
|
||||
function throws(block: () => void, error: () => void | ((err: any) => boolean) | RegExp, message?: string): void;
|
||||
function throws(block: () => void, error: (() => void) | ((err: any) => boolean) | RegExp, message?: string): void;
|
||||
|
||||
function doesNotThrow(block: () => void, message?: string): void;
|
||||
function doesNotThrow(block: () => void, error: () => void | ((err: any) => boolean) | RegExp, message?: string): void;
|
||||
function doesNotThrow(block: () => void, error: (() => void) | ((err: any) => boolean) | RegExp, message?: string): void;
|
||||
|
||||
function ifError(value: any): void;
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import Koa = require('koa');
|
||||
import asyncBusboy = require('async-busboy');
|
||||
|
||||
async function middleware(ctx: Koa.Context, next: () => Promise<any>) {
|
||||
const {files, fields} = await asyncBusboy(ctx.req);
|
||||
}
|
||||
|
||||
async function middleware2(ctx: Koa.Context, next: () => Promise<any>) {
|
||||
const {fields} = await asyncBusboy(ctx.req, {
|
||||
limits: {
|
||||
fileSize: 2 * 1024 * 1024,
|
||||
},
|
||||
onFile: (fieldname: string, file: NodeJS.ReadableStream, filename: string, encoding: string, mimetype: string) => {
|
||||
}
|
||||
});
|
||||
}
|
||||
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
// Type definitions for async-busboy 0.7
|
||||
// Project: https://github.com/m4nuC/async-busboy#readme
|
||||
// Definitions by: Hiroshi Ioka <https://github.com/hirochachacha>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as fs from 'fs';
|
||||
import * as http from 'http';
|
||||
|
||||
import busboy = require('busboy');
|
||||
|
||||
interface Options extends busboy.BusboyConfig {
|
||||
onFile: (
|
||||
fieldname: string,
|
||||
file: NodeJS.ReadableStream,
|
||||
filename: string,
|
||||
encoding: string,
|
||||
mimetype: string) => void;
|
||||
}
|
||||
|
||||
type AsyncBusboy = (
|
||||
req: http.IncomingMessage,
|
||||
options?: Options
|
||||
) => Promise<{fields: {[key: string]: any}; files?: fs.ReadStream[]}>;
|
||||
|
||||
declare const asyncBusboy: AsyncBusboy;
|
||||
|
||||
export = asyncBusboy;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"async-busboy-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -390,22 +390,22 @@ async.auto({
|
||||
get_data: function (callback: AsyncResultCallback<any>) { },
|
||||
make_folder: function (callback: AsyncResultCallback<any>) { },
|
||||
//arrays with different types are not accepted by TypeScript.
|
||||
write_file: ['get_data', 'make_folder', <any>function (callback: AsyncResultCallback<any>) {
|
||||
write_file: ['get_data', 'make_folder', function (callback: AsyncResultCallback<any>) {
|
||||
callback(null, filename);
|
||||
}],
|
||||
} as any],
|
||||
//arrays with different types are not accepted by TypeScript.
|
||||
email_link: ['write_file', <any>function (callback: AsyncResultCallback<any>, results: any) { }]
|
||||
email_link: ['write_file', function (callback: AsyncResultCallback<any>, results: any) { } as any]
|
||||
});
|
||||
|
||||
async.auto({
|
||||
get_data: function (callback: AsyncResultCallback<any>) { },
|
||||
make_folder: function (callback: AsyncResultCallback<any>) { },
|
||||
//arrays with different types are not accepted by TypeScript.
|
||||
write_file: ['get_data', 'make_folder', <any>function (callback: AsyncResultCallback<any>) {
|
||||
write_file: ['get_data', 'make_folder', function (callback: AsyncResultCallback<any>) {
|
||||
callback(null, filename);
|
||||
}],
|
||||
} as any],
|
||||
//arrays with different types are not accepted by TypeScript.
|
||||
email_link: ['write_file', <any>function (callback: AsyncResultCallback<any>, results: any) { }]
|
||||
email_link: ['write_file', function (callback: AsyncResultCallback<any>, results: any) { } as any]
|
||||
}, function (err, results) {
|
||||
console.log('finished auto');
|
||||
});
|
||||
@@ -421,11 +421,11 @@ async.auto<A>({
|
||||
get_data: function (callback: AsyncResultCallback<any>) { },
|
||||
make_folder: function (callback: AsyncResultCallback<any>) { },
|
||||
//arrays with different types are not accepted by TypeScript.
|
||||
write_file: ['get_data', 'make_folder', <any>function (callback: AsyncResultCallback<any>) {
|
||||
write_file: ['get_data', 'make_folder', function (callback: AsyncResultCallback<any>) {
|
||||
callback(null, filename);
|
||||
}],
|
||||
} as any],
|
||||
//arrays with different types are not accepted by TypeScript.
|
||||
email_link: ['write_file', <any>function (callback: AsyncResultCallback<any>, results: any) { }]
|
||||
email_link: ['write_file', function (callback: AsyncResultCallback<any>, results: any) { } as any]
|
||||
}, 1, function (err, results) {
|
||||
console.log('finished auto');
|
||||
});
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
import Tree from "@atlaskit/tree";
|
||||
|
||||
import * as React from "react";
|
||||
import { render } from "react-dom";
|
||||
|
||||
declare const container: Element;
|
||||
|
||||
render(
|
||||
<Tree
|
||||
tree={{
|
||||
rootId: 1,
|
||||
items: {
|
||||
1: {
|
||||
id: 1,
|
||||
children: []
|
||||
},
|
||||
"string-id": {
|
||||
id: "string-id",
|
||||
children: [1, "another"],
|
||||
hasChildren: true,
|
||||
isExpanded: false,
|
||||
isChildrenLoading: false,
|
||||
data: {
|
||||
myVar: "this can be anything"
|
||||
}
|
||||
}
|
||||
}
|
||||
}}
|
||||
renderItem={() => <div />}
|
||||
onExpand={() => {}}
|
||||
onCollapse={() => {}}
|
||||
onDragStart={() => {}}
|
||||
onDragEnd={() => {}}
|
||||
offsetPerLevel={20}
|
||||
isDragEnabled
|
||||
isNestingEnabled
|
||||
/>,
|
||||
container
|
||||
);
|
||||
|
||||
// Check that default props work too.
|
||||
render(<Tree renderItem={() => <div />} />, container);
|
||||
Vendored
+153
@@ -0,0 +1,153 @@
|
||||
// Type definitions for @atlaskit/tree 4.1
|
||||
// Project: https://bitbucket.org/atlassian/atlaskit-mk-2/
|
||||
// Definitions by: Ben James <https://github.com/benhjames>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.0
|
||||
|
||||
import { Component, ReactNode } from "react";
|
||||
|
||||
import {
|
||||
DraggingStyle,
|
||||
DraggableProvidedDragHandleProps,
|
||||
DraggableStateSnapshot,
|
||||
NotDraggingStyle
|
||||
} from "react-beautiful-dnd";
|
||||
|
||||
export type ItemId = any;
|
||||
|
||||
export type Path = number[];
|
||||
|
||||
export interface TreeData {
|
||||
rootId: ItemId;
|
||||
items: { [key: string]: TreeItem; [key: number]: TreeItem };
|
||||
}
|
||||
|
||||
export type TreeItemData = any;
|
||||
|
||||
export interface TreeItem {
|
||||
id: ItemId;
|
||||
children: ItemId[];
|
||||
hasChildren?: boolean;
|
||||
isExpanded?: boolean;
|
||||
isChildrenLoading?: boolean;
|
||||
data?: TreeItemData;
|
||||
}
|
||||
|
||||
export interface TreeSourcePosition {
|
||||
parentId: ItemId;
|
||||
index: number;
|
||||
}
|
||||
|
||||
export interface TreeDestinationPosition {
|
||||
parentId: ItemId;
|
||||
index?: number;
|
||||
}
|
||||
|
||||
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
||||
|
||||
interface TreeDraggingStyle extends Omit<DraggingStyle, "transition"> {
|
||||
paddingLeft: number;
|
||||
transition: "none" | string;
|
||||
}
|
||||
|
||||
type TreeDraggableStyle = NotDraggingStyle | TreeDraggingStyle;
|
||||
|
||||
interface TreeDraggableProps {
|
||||
// Props that can be spread onto the element directly
|
||||
// inline style
|
||||
style?: TreeDraggableStyle;
|
||||
// used for shared global styles
|
||||
"data-react-beautiful-dnd-draggable": string;
|
||||
}
|
||||
|
||||
interface TreeDraggableProvided {
|
||||
draggableProps: TreeDraggableProps;
|
||||
// will be null if the draggable is disabled
|
||||
dragHandleProps?: DraggableProvidedDragHandleProps;
|
||||
// The following props will be removed once we move to react 16
|
||||
innerRef: (element?: HTMLElement) => void;
|
||||
}
|
||||
|
||||
export interface RenderItemParams {
|
||||
item: TreeItem;
|
||||
depth: number;
|
||||
onExpand: (itemId: ItemId) => void;
|
||||
onCollapse: (itemId: ItemId) => void;
|
||||
provided: TreeDraggableProvided;
|
||||
snapshot: DraggableStateSnapshot;
|
||||
}
|
||||
|
||||
interface TreeItemMutation {
|
||||
id?: ItemId;
|
||||
children?: ItemId[];
|
||||
hasChildren?: boolean;
|
||||
isExpanded?: boolean;
|
||||
isChildrenLoading?: boolean;
|
||||
data?: TreeItemData;
|
||||
}
|
||||
|
||||
export function mutateTree(
|
||||
tree: TreeData,
|
||||
itemId: ItemId,
|
||||
mutation: TreeItemMutation
|
||||
): TreeData;
|
||||
|
||||
export function moveItemOnTree(
|
||||
tree: TreeData,
|
||||
from: TreeSourcePosition,
|
||||
to: TreeDestinationPosition
|
||||
): TreeData;
|
||||
|
||||
interface TreeProps {
|
||||
/** The tree data structure. */
|
||||
tree: TreeData;
|
||||
/** Function that will be called when a parent item needs to be expanded. */
|
||||
onExpand: (itemId: ItemId, path: Path) => void;
|
||||
/** Function that will be called when a parent item needs to be collapsed. */
|
||||
onCollapse: (itemId: ItemId, path: Path) => void;
|
||||
/** Function that will be called when the user starts dragging. */
|
||||
onDragStart: (itemId: ItemId) => void;
|
||||
/** Function that will be called when the user finishes dragging. */
|
||||
onDragEnd: (
|
||||
sourcePosition: TreeSourcePosition,
|
||||
destinationPosition: TreeDestinationPosition | undefined
|
||||
) => void;
|
||||
/** Function that will be called to render a single item. */
|
||||
renderItem: (itemProps: RenderItemParams) => ReactNode;
|
||||
/** Number of pixel is used to scaffold the tree by the consumer. */
|
||||
offsetPerLevel: number;
|
||||
/** Boolean to turn on drag&drop re-ordering on the tree */
|
||||
isDragEnabled: boolean;
|
||||
/** Boolean to turn on hovering while dragging */
|
||||
isNestingEnabled: boolean;
|
||||
}
|
||||
|
||||
interface FlattenedItem {
|
||||
item: TreeItem;
|
||||
path: Path;
|
||||
}
|
||||
|
||||
type FlattenedTree = FlattenedItem[];
|
||||
|
||||
interface TreeState {
|
||||
/** The flattened tree data structure transformed from props.tree */
|
||||
flattenedTree: FlattenedTree;
|
||||
// Id of the currently dragged item
|
||||
draggedItemId: ItemId;
|
||||
}
|
||||
|
||||
declare class Tree extends Component<TreeProps, TreeState> {
|
||||
static defaultProps: {
|
||||
tree: { children: [] };
|
||||
onExpand: () => void;
|
||||
onCollapse: () => void;
|
||||
onDragStart: () => void;
|
||||
onDragEnd: () => void;
|
||||
renderItem: () => void;
|
||||
offsetPerLevel: 35;
|
||||
isDragEnabled: false;
|
||||
isNestingEnabled: false;
|
||||
};
|
||||
}
|
||||
|
||||
export default Tree;
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6", "dom"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react",
|
||||
"paths": {
|
||||
"@atlaskit/tree": ["atlaskit__tree"]
|
||||
}
|
||||
},
|
||||
"files": ["index.d.ts", "atlaskit__tree-tests.tsx"]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -557,8 +557,8 @@ function testDesializerManager() {
|
||||
}
|
||||
|
||||
function isStorableClass(o: object): o is StorableClass {
|
||||
if (typeof o === "object" && (<StorableClass> o).name &&
|
||||
(<StorableClass> o).name === "test") {
|
||||
if (typeof o === "object" && (o as StorableClass).name &&
|
||||
(o as StorableClass).name === "test") {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
||||
@@ -136,6 +136,12 @@ webAuth.passwordlessStart({
|
||||
send: 'code'
|
||||
}, (err, data) => {});
|
||||
|
||||
webAuth.passwordlessLogin({
|
||||
connection: 'the_connection',
|
||||
phoneNumber: '123',
|
||||
verificationCode: '456'
|
||||
}, (err, data) => {});
|
||||
|
||||
webAuth.signupAndAuthorize({
|
||||
connection: 'the_connection',
|
||||
email: 'me@example.com',
|
||||
|
||||
Vendored
+14
@@ -270,6 +270,13 @@ export class WebAuth {
|
||||
*/
|
||||
passwordlessVerify(options: PasswordlessVerifyOptions, callback: Auth0Callback<any>): void;
|
||||
|
||||
/**
|
||||
* Logs in a user with the verification code sent to the user
|
||||
* @param options
|
||||
* @param callback
|
||||
*/
|
||||
passwordlessLogin(options: PasswordlessLoginOptions, callback: Auth0Callback<any>): void;
|
||||
|
||||
/**
|
||||
* Renews an existing session on Auth0's servers using `response_mode=web_message` (i.e. Auth0's hosted login page)
|
||||
*
|
||||
@@ -615,6 +622,13 @@ export interface PasswordlessVerifyOptions {
|
||||
send?: string;
|
||||
}
|
||||
|
||||
export interface PasswordlessLoginOptions {
|
||||
connection: string;
|
||||
verificationCode: string;
|
||||
phoneNumber?: string;
|
||||
email?: string;
|
||||
}
|
||||
|
||||
export interface Auth0UserProfile {
|
||||
name: string;
|
||||
nickname: string;
|
||||
|
||||
@@ -43,5 +43,7 @@ function test_client() {
|
||||
});
|
||||
};
|
||||
|
||||
connection.open();
|
||||
if (!connection.isOpen && !connection.isRetrying && connection.session == null) {
|
||||
connection.open();
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+5
-3
@@ -1,6 +1,6 @@
|
||||
// Type definitions for AutobahnJS v0.9.7
|
||||
// Type definitions for AutobahnJS 0.9
|
||||
// Project: http://autobahn.ws/js/
|
||||
// Definitions by: Elad Zelingher <https://github.com/darkl>, Andy Hawkins <https://github.com/a904guy/,http://a904guy.com/,http://www.bmbsqd.com>, Wladimir Totino <https://github.com/valepu>, Mathias Teier <https://github.com/glenroy37/,http://kagent.at>
|
||||
// Definitions by: Elad Zelingher <https://github.com/darkl>, Andy Hawkins <https://github.com/a904guy>, Wladimir Totino <https://github.com/valepu>, Mathias Teier <https://github.com/glenroy37>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="when" />
|
||||
@@ -191,7 +191,9 @@ declare namespace autobahn {
|
||||
constructor(options?: IConnectionOptions);
|
||||
|
||||
isOpen: boolean;
|
||||
|
||||
isRetrying: boolean;
|
||||
session?: Session;
|
||||
|
||||
open(): void;
|
||||
|
||||
close(reason?: string, message?: string): void;
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
|
||||
@@ -118,12 +118,18 @@ str = apiGwEvt.resource;
|
||||
str = customAuthorizerEvt.type;
|
||||
str = customAuthorizerEvt.methodArn;
|
||||
strOrUndefined = customAuthorizerEvt.authorizationToken;
|
||||
strOrUndefined = customAuthorizerEvt.resource;
|
||||
strOrUndefined = customAuthorizerEvt.path;
|
||||
strOrUndefined = customAuthorizerEvt.httpMethod;
|
||||
str = customAuthorizerEvt.headers!["example"];
|
||||
str = customAuthorizerEvt.multiValueHeaders!["example"][0];
|
||||
str = customAuthorizerEvt.pathParameters!["example"];
|
||||
str = customAuthorizerEvt.queryStringParameters!["example"];
|
||||
str = customAuthorizerEvt.multiValueQueryStringParameters!["example"][0];
|
||||
str = customAuthorizerEvt.stageVariables!["example"];
|
||||
apiGwEvtReqCtxOpt = customAuthorizerEvt.requestContext;
|
||||
strOrUndefined = customAuthorizerEvt.domainName;
|
||||
strOrUndefined = customAuthorizerEvt.apiId;
|
||||
|
||||
/* DynamoDB Stream Event */
|
||||
const dynamoDBStreamEvent: AWSLambda.DynamoDBStreamEvent = {
|
||||
@@ -599,6 +605,27 @@ const CodePipelineEvent: AWSLambda.CodePipelineEvent = {
|
||||
|
||||
CodePipelineEvent["CodePipeline.job"].data.encryptionKey = { type: 'KMS', id: 'key' };
|
||||
|
||||
/* CodePipeline CloudWatch Events
|
||||
* see https://docs.aws.amazon.com/codepipeline/latest/userguide/detect-state-changes-cloudwatch-events.html
|
||||
* Their documentation says that detail.version is a string, but it is actually an integer
|
||||
*/
|
||||
const CodePipelineCloudWatchEvent: AWSLambda.CodePipelineCloudWatchEvent = {
|
||||
version: '0',
|
||||
id: 'event_Id',
|
||||
'detail-type': 'CodePipeline Pipeline Execution State Change',
|
||||
source: 'aws.codepipeline',
|
||||
account: 'Pipeline_Account',
|
||||
time: 'TimeStamp',
|
||||
region: 'us-east-1',
|
||||
resources: ['arn:aws:codepipeline:us-east-1:account_ID:myPipeline'],
|
||||
detail: {
|
||||
pipeline: 'myPipeline',
|
||||
version: 1,
|
||||
state: 'STARTED',
|
||||
'execution-id': 'execution_Id',
|
||||
},
|
||||
};
|
||||
|
||||
/* CloudFront events, see http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html */
|
||||
const CloudFrontRequestWithCustomOriginEvent: AWSLambda.CloudFrontRequestEvent = {
|
||||
Records: [
|
||||
|
||||
Vendored
+115
@@ -24,6 +24,7 @@
|
||||
// Oliver Hookins <https://github.com/ohookins>
|
||||
// Trevor Leach <https://github.com/trevor-leach>
|
||||
// James Gregory <https://github.com/jagregory>
|
||||
// Erik Dalén <https://github.com/dalen>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -78,12 +79,18 @@ export interface CustomAuthorizerEvent {
|
||||
type: string;
|
||||
methodArn: string;
|
||||
authorizationToken?: string;
|
||||
resource?: string;
|
||||
path?: string;
|
||||
httpMethod?: string;
|
||||
headers?: { [name: string]: string };
|
||||
multiValueHeaders?: { [name: string]: string[] };
|
||||
pathParameters?: { [name: string]: string } | null;
|
||||
queryStringParameters?: { [name: string]: string } | null;
|
||||
multiValueQueryStringParameters?: { [name: string]: string[] } | null;
|
||||
stageVariables?: { [name: string]: string };
|
||||
requestContext?: APIGatewayEventRequestContext;
|
||||
domainName?: string;
|
||||
apiId?: string;
|
||||
}
|
||||
|
||||
// Context
|
||||
@@ -576,6 +583,109 @@ export interface CodePipelineEvent {
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* CodePipeline CloudWatch Events
|
||||
* https://docs.aws.amazon.com/codepipeline/latest/userguide/detect-state-changes-cloudwatch-events.html
|
||||
*
|
||||
* The above CodePipelineEvent is when a lambda is invoked by a CodePipeline.
|
||||
* These events are when you subsribe to CodePipeline events in CloudWatch.
|
||||
*
|
||||
* Their documentation says that detail.version is a string, but it is actually an integer
|
||||
*/
|
||||
export type CodePipelineState =
|
||||
| 'STARTED'
|
||||
| 'SUCCEEDED'
|
||||
| 'RESUMED'
|
||||
| 'FAILED'
|
||||
| 'CANCELED'
|
||||
| 'SUPERSEDED';
|
||||
|
||||
export type CodePipelineStageState =
|
||||
| 'STARTED'
|
||||
| 'SUCCEEDED'
|
||||
| 'RESUMED'
|
||||
| 'FAILED'
|
||||
| 'CANCELED';
|
||||
|
||||
export type CodePipelineActionState =
|
||||
| 'STARTED'
|
||||
| 'SUCCEEDED'
|
||||
| 'FAILED'
|
||||
| 'CANCELED';
|
||||
|
||||
export interface CodePipelineCloudWatchPipelineEvent {
|
||||
version: string;
|
||||
id: string;
|
||||
'detail-type': 'CodePipeline Pipeline Execution State Change';
|
||||
source: 'aws.codepipeline';
|
||||
account: string;
|
||||
time: string;
|
||||
region: string;
|
||||
resources: string[];
|
||||
detail: {
|
||||
pipeline: string;
|
||||
version: number;
|
||||
state: CodePipelineState;
|
||||
'execution-id': string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface CodePipelineCloudWatchStageEvent {
|
||||
version: string;
|
||||
id: string;
|
||||
'detail-type': 'CodePipeline Stage Execution State Change';
|
||||
source: 'aws.codepipeline';
|
||||
account: string;
|
||||
time: string;
|
||||
region: string;
|
||||
resources: string[];
|
||||
detail: {
|
||||
pipeline: string;
|
||||
version: number;
|
||||
'execution-id': string;
|
||||
stage: string;
|
||||
state: CodePipelineStageState;
|
||||
};
|
||||
}
|
||||
|
||||
export type CodePipelineActionCategory =
|
||||
| 'Approval'
|
||||
| 'Build'
|
||||
| 'Deploy'
|
||||
| 'Invoke'
|
||||
| 'Source'
|
||||
| 'Test';
|
||||
|
||||
export interface CodePipelineCloudWatchActionEvent {
|
||||
version: string;
|
||||
id: string;
|
||||
'detail-type': 'CodePipeline Action Execution State Change';
|
||||
source: 'aws.codepipeline';
|
||||
account: string;
|
||||
time: string;
|
||||
region: string;
|
||||
resources: string[];
|
||||
detail: {
|
||||
pipeline: string;
|
||||
version: number;
|
||||
'execution-id': string;
|
||||
stage: string;
|
||||
action: string;
|
||||
state: CodePipelineActionState;
|
||||
type: {
|
||||
owner: 'AWS' | 'Custom' | 'ThirdParty';
|
||||
category: CodePipelineActionCategory;
|
||||
provider: string;
|
||||
version: number;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export type CodePipelineCloudWatchEvent =
|
||||
| CodePipelineCloudWatchPipelineEvent
|
||||
| CodePipelineCloudWatchStageEvent
|
||||
| CodePipelineCloudWatchActionEvent;
|
||||
|
||||
/**
|
||||
* CloudFront events
|
||||
* http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-event-structure.html
|
||||
@@ -837,6 +947,11 @@ export type ProxyCallback = APIGatewayProxyCallback; // Old name
|
||||
|
||||
export type CodePipelineHandler = Handler<CodePipelineEvent, void>;
|
||||
|
||||
export type CodePipelineCloudWatchHandler = Handler<CodePipelineCloudWatchEvent, void>;
|
||||
export type CodePipelineCloudWatchPipelineHandler = Handler<CodePipelineCloudWatchPipelineEvent, void>;
|
||||
export type CodePipelineCloudWatchStageHandler = Handler<CodePipelineCloudWatchStageEvent, void>;
|
||||
export type CodePipelineCloudWatchActionHandler = Handler<CodePipelineCloudWatchActionEvent, void>;
|
||||
|
||||
export type CloudFrontRequestHandler = Handler<CloudFrontRequestEvent, CloudFrontRequestResult>;
|
||||
export type CloudFrontRequestCallback = Callback<CloudFrontRequestResult>;
|
||||
|
||||
|
||||
@@ -7,15 +7,18 @@ const options: babel.TransformOptions = {
|
||||
|
||||
babel.transform("code();", options, (err, result) => {
|
||||
const { code, map, ast } = result!;
|
||||
const { body } = ast!.program;
|
||||
});
|
||||
|
||||
const transformSyncResult = babel.transformSync("code();", options);
|
||||
if (transformSyncResult) {
|
||||
const { code, map, ast } = transformSyncResult;
|
||||
const { body } = ast!.program;
|
||||
}
|
||||
|
||||
babel.transformFile("filename.js", options, (err, result) => {
|
||||
const { code, map, ast } = result!;
|
||||
const { body } = ast!.program;
|
||||
});
|
||||
|
||||
babel.transformFileSync("filename.js", options)!.code;
|
||||
@@ -25,7 +28,14 @@ const parsedAst = babel.parse(sourceCode, options);
|
||||
|
||||
babel.transformFromAst(parsedAst!, sourceCode, options, (err, result) => {
|
||||
const { code, map, ast } = result!;
|
||||
const { body } = ast!.program;
|
||||
});
|
||||
|
||||
const transformFromAstSyncResult = babel.transformFromAstSync(parsedAst!, sourceCode, options);
|
||||
const { code, map, ast } = transformFromAstSyncResult!;
|
||||
const { body } = ast!.program;
|
||||
|
||||
babel.transformFromAstAsync(parsedAst!, sourceCode, options).then(transformFromAstAsyncResult => {
|
||||
const { code, map, ast } = transformFromAstAsyncResult!;
|
||||
const { body } = ast!.program;
|
||||
});
|
||||
|
||||
Vendored
+2
-2
@@ -349,7 +349,7 @@ export function transformFromAstSync(ast: Node, code?: string, opts?: TransformO
|
||||
/**
|
||||
* Given an AST, transform it.
|
||||
*/
|
||||
export function transformFromAstSync(ast: Node, code?: string, opts?: TransformOptions): Promise<BabelFileResult | null>;
|
||||
export function transformFromAstAsync(ast: Node, code?: string, opts?: TransformOptions): Promise<BabelFileResult | null>;
|
||||
|
||||
// A babel plugin is a simple function which must return an object matching
|
||||
// the following interface. Babel will throw if it finds unknown properties.
|
||||
@@ -365,7 +365,7 @@ export interface PluginObj<S = {}> {
|
||||
}
|
||||
|
||||
export interface BabelFileResult {
|
||||
ast?: Node | null;
|
||||
ast?: t.File | null;
|
||||
code?: string | null;
|
||||
ignored?: boolean;
|
||||
map?: {
|
||||
|
||||
@@ -4,10 +4,14 @@ import * as t from "@babel/types";
|
||||
// Examples from: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md
|
||||
const MyVisitor: Visitor = {
|
||||
Identifier: {
|
||||
enter() {
|
||||
enter(path) {
|
||||
// $ExpectType NodePath<Identifier>
|
||||
path;
|
||||
console.log("Entered!");
|
||||
},
|
||||
exit() {
|
||||
exit(path) {
|
||||
// $ExpectType NodePath<Identifier>
|
||||
path;
|
||||
console.log("Exited!");
|
||||
}
|
||||
}
|
||||
@@ -89,7 +93,8 @@ const v1: Visitor = {
|
||||
|
||||
const id = path.scope.generateUidIdentifierBasedOnNode(path.node.id!);
|
||||
path.remove();
|
||||
path.scope.parent.push({ id, init: path.node });
|
||||
path.scope.parent.push({ id });
|
||||
path.scope.parent.push({ id, init: t.stringLiteral('foo'), kind: "const" });
|
||||
|
||||
path.scope.rename("n", "x");
|
||||
path.scope.rename("n");
|
||||
@@ -104,7 +109,44 @@ const BindingKindTest: Visitor = {
|
||||
kind === 'const';
|
||||
kind === 'let';
|
||||
kind === 'var';
|
||||
// The following should fail when uncommented
|
||||
// kind === 'anythingElse';
|
||||
// $ExpectError
|
||||
kind === 'anythingElse';
|
||||
},
|
||||
};
|
||||
|
||||
interface SomeVisitorState { someState: string; }
|
||||
|
||||
const VisitorStateTest: Visitor<SomeVisitorState> = {
|
||||
enter(path, state) {
|
||||
// $ExpectType SomeVisitorState
|
||||
state;
|
||||
// $ExpectType SomeVisitorState
|
||||
this;
|
||||
},
|
||||
exit(path, state) {
|
||||
// $ExpectType SomeVisitorState
|
||||
state;
|
||||
// $ExpectType SomeVisitorState
|
||||
this;
|
||||
},
|
||||
Identifier(path, state) {
|
||||
// $ExpectType SomeVisitorState
|
||||
state;
|
||||
// $ExpectType SomeVisitorState
|
||||
this;
|
||||
},
|
||||
FunctionDeclaration: {
|
||||
enter(path, state) {
|
||||
// $ExpectType SomeVisitorState
|
||||
state;
|
||||
// $ExpectType SomeVisitorState
|
||||
this;
|
||||
},
|
||||
exit(path, state) {
|
||||
// $ExpectType SomeVisitorState
|
||||
state;
|
||||
// $ExpectType SomeVisitorState
|
||||
this;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Vendored
+14
-9
@@ -90,11 +90,16 @@ export class Scope {
|
||||
|
||||
removeData(key: string): void;
|
||||
|
||||
push(opts: any): void;
|
||||
push(opts: {
|
||||
id: t.LVal,
|
||||
init?: t.Expression,
|
||||
unique?: boolean,
|
||||
kind?: "var" | "let" | "const",
|
||||
}): void;
|
||||
|
||||
getProgramParent(): Scope;
|
||||
|
||||
getFunctionParent(): Scope;
|
||||
getFunctionParent(): Scope | null;
|
||||
|
||||
getBlockParent(): Scope;
|
||||
|
||||
@@ -138,17 +143,17 @@ export class Binding {
|
||||
constantViolations: NodePath[];
|
||||
}
|
||||
|
||||
export type Visitor<S = Node> = VisitNodeObject<Node> & {
|
||||
[P in Node["type"]]?: VisitNode<S, Extract<Node, { type: P; }>>;
|
||||
export type Visitor<S = {}> = VisitNodeObject<S, Node> & {
|
||||
[Type in Node["type"]]?: VisitNode<S, Extract<Node, { type: Type; }>>;
|
||||
};
|
||||
|
||||
export type VisitNode<T, P> = VisitNodeFunction<T, P> | VisitNodeObject<T>;
|
||||
export type VisitNode<S, P> = VisitNodeFunction<S, P> | VisitNodeObject<S, P>;
|
||||
|
||||
export type VisitNodeFunction<T, P> = (this: T, path: NodePath<P>, state: any) => void;
|
||||
export type VisitNodeFunction<S, P> = (this: S, path: NodePath<P>, state: S) => void;
|
||||
|
||||
export interface VisitNodeObject<T> {
|
||||
enter?(path: NodePath<T>, state: any): void;
|
||||
exit?(path: NodePath<T>, state: any): void;
|
||||
export interface VisitNodeObject<S, P> {
|
||||
enter?: VisitNodeFunction<S, P>;
|
||||
exit?: VisitNodeFunction<S, P>;
|
||||
}
|
||||
|
||||
export class NodePath<T = Node> {
|
||||
|
||||
@@ -64,7 +64,7 @@ const modelOpts: Backbone.ModelFetchWithCacheOptions = {
|
||||
context: {},
|
||||
};
|
||||
|
||||
const hoge = <Backbone.ModelWithCache> new Backbone.Model;
|
||||
const hoge = new Backbone.Model() as Backbone.ModelWithCache;
|
||||
hoge.fetch(modelOpts);
|
||||
|
||||
const collectionOpts: Backbone.CollectionFetchWithCacheOptions = {
|
||||
@@ -76,5 +76,5 @@ const collectionOpts: Backbone.CollectionFetchWithCacheOptions = {
|
||||
prefillSuccess: (self: any) => { },
|
||||
};
|
||||
|
||||
const fuga = <Backbone.CollectionWithCache> new Backbone.Collection;
|
||||
const fuga = new Backbone.Collection() as Backbone.CollectionWithCache;
|
||||
fuga.fetch(collectionOpts);
|
||||
|
||||
Vendored
+13
-1
@@ -122,7 +122,19 @@ declare module 'backbone' {
|
||||
|
||||
}
|
||||
|
||||
export class Store extends Events {
|
||||
export class Store implements Events {
|
||||
on(eventName: string, callback?: (...args: any[]) => void, context?: any): any;
|
||||
on(eventMap: EventsHash): any;
|
||||
on(eventName: any, callback?: any, context?: any): any;
|
||||
off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any;
|
||||
trigger(eventName: string, ...args: any[]): any;
|
||||
bind(eventName: string, callback: (...args: any[]) => void, context?: any): any;
|
||||
unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any;
|
||||
once(events: string, callback: (...args: any[]) => void, context?: any): any;
|
||||
listenTo(object: any, events: string, callback: (...args: any[]) => void): any;
|
||||
listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any;
|
||||
stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any;
|
||||
|
||||
initializeRelation(model, relation, options);
|
||||
|
||||
addModelScope(scope:any):void;
|
||||
|
||||
Vendored
+13
-1
@@ -407,9 +407,21 @@ export interface ObjectOptions extends RadioMixinOptions {
|
||||
* A base class which other classes can extend from. Object incorporates many
|
||||
* backbone conventions and utilities like initialize and Backbone.Events.
|
||||
*/
|
||||
export class Object extends Backbone.Events implements CommonMixin, RadioMixin {
|
||||
export class Object implements CommonMixin, RadioMixin, Backbone.Events {
|
||||
constructor(options?: ObjectOptions);
|
||||
|
||||
on(eventName: string, callback?: (...args: any[]) => void, context?: any): any;
|
||||
on(eventMap: EventsHash): any;
|
||||
on(eventName: any, callback?: any, context?: any): any;
|
||||
off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any;
|
||||
trigger(eventName: string, ...args: any[]): any;
|
||||
bind(eventName: string, callback: (...args: any[]) => void, context?: any): any;
|
||||
unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any;
|
||||
once(events: string, callback: (...args: any[]) => void, context?: any): any;
|
||||
listenTo(object: any, events: string, callback: (...args: any[]) => void): any;
|
||||
listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any;
|
||||
stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any;
|
||||
|
||||
/**
|
||||
* Receives a hash of event names and functions and/or function names,
|
||||
* and returns the same hash with the function names replaced with the
|
||||
|
||||
@@ -70,8 +70,8 @@ namespace InitializingWithOptions {
|
||||
});
|
||||
|
||||
var testCollection6 = new TestCollection([
|
||||
<TestModel>{},
|
||||
<TestModel>{},
|
||||
{} as TestModel,
|
||||
{} as TestModel,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Vendored
+12
-1
@@ -71,7 +71,18 @@ declare module "backbone" {
|
||||
stopReplying(commandName?: string, callback?: (...args: any[]) => any, context?: any): Requests;
|
||||
}
|
||||
|
||||
class Channel extends Backbone.Events implements Commands, Requests {
|
||||
class Channel implements Commands, Requests, Backbone.Events {
|
||||
on(eventName: string, callback?: (...args: any[]) => void, context?: any): any;
|
||||
on(eventMap: EventsHash): any;
|
||||
on(eventName: any, callback?: any, context?: any): any;
|
||||
off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any;
|
||||
trigger(eventName: string, ...args: any[]): any;
|
||||
bind(eventName: string, callback: (...args: any[]) => void, context?: any): any;
|
||||
unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any;
|
||||
once(events: string, callback: (...args: any[]) => void, context?: any): any;
|
||||
listenTo(object: any, events: string, callback: (...args: any[]) => void): any;
|
||||
listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any;
|
||||
stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any;
|
||||
channelName: string;
|
||||
reset(): Channel;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
function test_events() {
|
||||
|
||||
var object = new Backbone.Events();
|
||||
var object = Backbone.Events;
|
||||
object.on("alert", (eventName: string) => alert("Triggered " + eventName));
|
||||
|
||||
object.trigger("alert", "an event");
|
||||
|
||||
Vendored
+48
-16
@@ -3,6 +3,7 @@
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov>
|
||||
// Natan Vivo <https://github.com/nvivo>
|
||||
// kenjiru <https://github.com/kenjiru>
|
||||
// jjoekoullas <https://github.com/jjoekoullas>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -91,24 +92,37 @@ declare namespace Backbone {
|
||||
}
|
||||
|
||||
interface EventsHash {
|
||||
[selector: string]: string | {(eventObject: JQueryEventObject): void};
|
||||
[selector: string]: string | {(eventObject: JQuery.TriggeredEvent): void};
|
||||
}
|
||||
|
||||
class Events {
|
||||
export const Events: Events;
|
||||
interface Events {
|
||||
on(eventName: string, callback?: (...args: any[]) => void, context?: any): any;
|
||||
on(eventMap: EventsHash): any;
|
||||
off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any;
|
||||
trigger(eventName: string, ...args: any[]): any;
|
||||
bind(eventName: string, callback: (...args: any[]) => void, context?: any): any;
|
||||
unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any;
|
||||
|
||||
once(events: string, callback: (...args: any[]) => void, context?: any): any;
|
||||
listenTo(object: any, events: string, callback: (...args: any[]) => void): any;
|
||||
listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any;
|
||||
stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any;
|
||||
}
|
||||
|
||||
class ModelBase implements Events {
|
||||
on(eventName: string, callback?: Function, context?: any): any;
|
||||
on(eventMap: EventsHash): any;
|
||||
off(eventName?: string, callback?: Function, context?: any): any;
|
||||
trigger(eventName: string, ...args: any[]): any;
|
||||
bind(eventName: string, callback: Function, context?: any): any;
|
||||
unbind(eventName?: string, callback?: Function, context?: any): any;
|
||||
on(eventName: any, callback?: any, context?: any): any
|
||||
off(eventName?: string, callback?: Function, context?: any): any
|
||||
trigger(eventName: string, ...args: any[]): any
|
||||
bind(eventName: string, callback: Function, context?: any): any
|
||||
unbind(eventName?: string, callback?: Function, context?: any): any
|
||||
once(events: string, callback: Function, context?: any): any
|
||||
listenTo(object: any, events: string, callback: Function):any
|
||||
listenToOnce(object: any, events: string, callback: Function): any
|
||||
stopListening(object?: any, events?: string, callback?: Function): any
|
||||
|
||||
once(events: string, callback: Function, context?: any): any;
|
||||
listenTo(object: any, events: string, callback: Function): any;
|
||||
listenToOnce(object: any, events: string, callback: Function): any;
|
||||
stopListening(object?: any, events?: string, callback?: Function): any;
|
||||
}
|
||||
|
||||
class ModelBase extends Events {
|
||||
parse(response: any, options?: any): any;
|
||||
toJSON(options?: any): any;
|
||||
sync(...arg: any[]): JQueryXHR;
|
||||
@@ -353,7 +367,7 @@ declare namespace Backbone {
|
||||
without(...values: TModel[]): TModel[];
|
||||
}
|
||||
|
||||
class Router extends Events {
|
||||
class Router extends EventSignatures {
|
||||
|
||||
/**
|
||||
* Do not use, prefer TypeScript's extend functionality.
|
||||
@@ -382,7 +396,7 @@ declare namespace Backbone {
|
||||
|
||||
var history: History;
|
||||
|
||||
class History extends Events {
|
||||
class History extends EventSignatures {
|
||||
|
||||
handlers: any[];
|
||||
interval: number;
|
||||
@@ -419,7 +433,7 @@ declare namespace Backbone {
|
||||
attributes?: {[id: string]: any};
|
||||
}
|
||||
|
||||
class View<TModel extends Model> extends Events {
|
||||
class View<TModel extends Model> extends EventSignatures {
|
||||
|
||||
/**
|
||||
* Do not use, prefer TypeScript's extend functionality.
|
||||
@@ -471,3 +485,21 @@ declare namespace Backbone {
|
||||
function noConflict(): typeof Backbone;
|
||||
var $: JQueryStatic;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is not for external use and is only here as a convenient way to
|
||||
* specify signatures for internal implementers of Backbone.Events
|
||||
*/
|
||||
declare abstract class EventSignatures implements Backbone.Events {
|
||||
on(eventName: string, callback?: (...args: any[]) => void, context?: any): any;
|
||||
on(eventMap: Backbone.EventsHash): any;
|
||||
off(eventName?: string, callback?: (...args: any[]) => void, context?: any): any;
|
||||
trigger(eventName: string, ...args: any[]): any;
|
||||
bind(eventName: string, callback: (...args: any[]) => void, context?: any): any;
|
||||
unbind(eventName?: string, callback?: (...args: any[]) => void, context?: any): any;
|
||||
|
||||
once(events: string, callback: (...args: any[]) => void, context?: any): any;
|
||||
listenTo(object: any, events: string, callback: (...args: any[]) => void): any;
|
||||
listenToOnce(object: any, events: string, callback: (...args: any[]) => void): any;
|
||||
stopListening(object?: any, events?: string, callback?: (...args: any[]) => void): any;
|
||||
}
|
||||
@@ -120,7 +120,7 @@ function CommonMethodsInEventStreamsAndProperties() {
|
||||
Bacon.fromArray([1, 2, 3]).withStateMachine(0, (sum, event) => {
|
||||
if (event.hasValue()) {
|
||||
// had to cast to `number` because event:Bacon.Next<number>|Bacon.Error<{}>
|
||||
return [sum + <number>event.value(), []];
|
||||
return [sum + (event.value() as number), []];
|
||||
}
|
||||
else if (event.isEnd()) {
|
||||
return [undefined, [new Bacon.Next(sum), event]];
|
||||
@@ -140,8 +140,8 @@ function CommonMethodsInEventStreamsAndProperties() {
|
||||
|
||||
{
|
||||
// This is handy for keeping track whether we are currently awaiting an AJAX response:
|
||||
var ajaxRequest = <Bacon.Observable<Error, JQueryXHR>>{},
|
||||
ajaxResponse = <Bacon.Observable<Error, JQueryXHR>>{},
|
||||
var ajaxRequest = {} as Bacon.Observable<Error, JQueryXHR>,
|
||||
ajaxResponse = {} as Bacon.Observable<Error, JQueryXHR>,
|
||||
showAjaxIndicator = ajaxRequest.awaiting(ajaxResponse);
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Vendored
+4758
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"dom",
|
||||
"esnext"
|
||||
],
|
||||
"strictFunctionTypes": true,
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"baidu-app-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"no-console": false,
|
||||
"semicolon": true
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,10 @@
|
||||
import * as baseX from 'base-x';
|
||||
|
||||
import * as basex from 'base-x';
|
||||
const BASE58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
||||
const bs58 = baseX(BASE58);
|
||||
|
||||
let bs16 = basex('0123456789ABCDEF');
|
||||
const decoded = bs58.decode('5Kd3NBUAdUnhyzenEwVLy9pBKxSwXvE9FMPyR4UKZvpe6E3AgLr');
|
||||
decoded; // $ExpectType Buffer
|
||||
bs58.decodeUnsafe('5Kd3NBUAdUnhyzenEwVLy9pBKxSwXvE9FMPyR4UKZvpe6E3AgLr'); // $ExpectType Buffer | undefined
|
||||
|
||||
{
|
||||
let encoded: string;
|
||||
|
||||
encoded = bs16.encode([255]);
|
||||
encoded = bs16.encode({0: 255, length: 1});
|
||||
}
|
||||
|
||||
let decoded: number[] = bs16.decode('FF');
|
||||
bs58.encode(decoded); // $ExpectType string
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user