Skip to content

Commit

Permalink
Merge branch 'DefinitelyTyped:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
mohitpubnub authored Aug 14, 2023
2 parents 6e82f1a + f3b3be9 commit f00b0b2
Show file tree
Hide file tree
Showing 423 changed files with 53,540 additions and 39,022 deletions.
9 changes: 9 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,15 @@ module.exports = {
'prefer-declare-function': 'error',
'redundant-undefined': 'error',
'trim-file': 'error',
'@typescript-eslint/ban-ts-comment': [
'error',
{
'ts-expect-error': false, // Used in tests.
'ts-ignore': 'allow-with-description',
'ts-nocheck': true,
'ts-check': false,
}
],
},
settings: {
jsdoc: {
Expand Down
49 changes: 33 additions & 16 deletions .github/CODEOWNERS

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion .github/workflows/ghostbuster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,9 @@ jobs:
branch-suffix: short-commit-hash
delete-branch: true
title: Remove contributors with deleted accounts
body: "Generated from [.github/workflows/ghostbuster.yml](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/.github/workflows/ghostbuster.yml)"
body: |
Generated from [.github/workflows/ghostbuster.yml](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/.github/workflows/ghostbuster.yml)
Some of these users may have simply changed their usernames; you may want do a bit of searching and ping them to see if they still want to be owners.
655 changes: 655 additions & 0 deletions README.fr.md

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

> The repository for *high quality* TypeScript type definitions.
*You can also read this README in [Español](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.es.md), [한국어](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.ko.md), [Русский](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.ru.md), [简体中文](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.zh-Hans.md), [Português](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.pt.md), [Italiano](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.it.md)
and [日本語](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.ja.md)!*
*You can also read this README in [Español](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.es.md), [한국어](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.ko.md), [Русский](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.ru.md), [简体中文](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.zh-Hans.md), [Português](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.pt.md), [Italiano](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.it.md), [日本語](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.ja.md) and [Français](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.fr.md)!*

*Link to [Admin manual](./docs/admin.md)*

Expand Down
24 changes: 20 additions & 4 deletions README.zh-Hans.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@ npm install --save-dev @types/node
更多信息请参见[手册](https://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html)

例如,若 npm 软件包名为“foo”,其类型声明的包名应为“@types/foo”。
若你无法找到相应的软件包,请在 [TypeSearch](https://microsoft.github.io/TypeSearch/) 中查询。

若仍然无法找到,请检查此软件包是否自我[捆绑](https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html)了类型声明。
你通常可以在 `package.json` 文件中的 `"types"``"typings"` 字段中找到这些文件,
或直接在软件包目录中寻找“.d.ts”文件,并通过 `/// <reference path="" />` 手动引入。
如果你的软件包使用 ``package.json`` 中的 ``types````typings`` 关键字指定了类型,那么 npm 注册表就会像这样显示该软件包有可用的绑定:

![image](https://user-images.githubusercontent.com/30049719/228748963-56fabfd1-9101-42c2-9891-b586b775b01e.png)

如果还是找不到类型,只需查找软件包中的任何".d.ts "文件,然后用 `/// <reference path="" />` 手动将其包含在内即可

#### 支持周期

Expand Down Expand Up @@ -397,6 +398,10 @@ Definitely Typed 有“类型定义所有者”的概念——即愿意维护特

类型定义所有者会被同步到文件 [.github/CODEOWNERS](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/.github/CODEOWNERS),每周更新一次。此文件就是我们的事实来源(Source of Truth)。

## The history of Definitely Typed

Definitely TypedGitHub 上最活跃的软件源之一。你可能想知道这个项目是如何诞生的。@johnnyreilly 整理了 Definitely Typed 的历史。它讲述了 Definitely Typed 早期的故事,从 @borisyankov 创建仓库到成为 TypeScript 生态系统的关键部分。您可以在这里[阅读 Definitely Typed 的故事](https://johnnyreilly.com/definitely-typed-the-movie)。

## 常见问题(FAQ

#### 这个仓库和 npm 上的 `@types` 软件包究竟是什么关系?
Expand Down Expand Up @@ -443,6 +448,17 @@ npm 软件包应该会在几分钟内更新。如果已经超过了一小时,

如果类型是 Web 标准的一部分,它们应该贡献给 [TSJS-lib-generator](https://github.com/Microsoft/TSJS-lib-generator),以便其成为默认 `lib.dom.d.ts` 的一部分。

#### 没有匹配软件包的类型定义怎么办?

如果完全没有 Javascript 源代码,例如您正在编写辅助类型或规范类型,则应自行发布这些类型,而不是在 Definitely Typed 上发布。
因为 `@types` 包的目的是为现有 Javascript 代码提供类型,所以不能直接导入。
也就是说,你不应该创建一个类似于 `import type { ... } from "@types/foo"`Definitely Typed 包。
`foo` 未安装时,也不要指望写出 `import type { ... } from "foo"`

这不同于为浏览器专用 Javascript 库提供类型,也不同于为整个环境(如 nodebun 等)提供类型。
在那种情况下,要么隐式地解析类型,要么使用 `/// <references types="foo" />` 来解析。


#### 如果一个软件包导出的不是模块对象,为了能使用 ES6 风格的导入语法,我应该向软件包中添加一个空命名空间吗?

有些软件包,比如 [chai-http](https://github.com/chaijs/chai-http),导出内容为一个函数。
Expand Down
4 changes: 4 additions & 0 deletions notNeededPackages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,10 @@
"libraryName": "credit-card-type",
"asOfVersion": "9.0.0"
},
"cron": {
"libraryName": "cron",
"asOfVersion": "2.4.0"
},
"cron-converter": {
"libraryName": "cron-converter",
"asOfVersion": "2.0.0"
Expand Down
6 changes: 6 additions & 0 deletions types/akamai-edgeworkers/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ declare namespace EW {
* @param deny_reason The deny reason set if the status code is a 403
*/
respondWith(status: number, headers: object, body: string, deny_reason?: string): void;

/**
* Checks if the request has been terminated. Returns `true` after
* `respondWith()` has been called.
*/
wasTerminated(): boolean;
}

interface HasStatus {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ export function onOriginResponse(request: EW.EgressOriginRequest, response: EW.E
if (target != null && target[0] === 'onOriginResponse-respondWith') {
request.respondWith(418, { 'from-respond-with': "frw value" }, "frw body");
}

// verify wasTerminated() returns a boolean
if (request.wasTerminated()) {
request.respondWith(419, {}, 'overwritten!');
}
}

export function onClientResponse(request: EW.EgressClientRequest, response: EW.EgressClientResponse) {
Expand Down
21 changes: 21 additions & 0 deletions types/atlassian-connect-js/atlassian-connect-js-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ AP.confluence.saveMacro({ foo: 'bar' }); // $ExpectType void
AP.confluence.closeMacroEditor(); // $ExpectType void
AP.confluence.getMacroBody(body => console.log(body)); // $ExpectType void
AP.confluence.getMacroData(data => console.log(data)); // $ExpectType void
AP.confluence.getMacroData<{ foo: string; bar: number }>(({ foo, bar }) => console.log(foo, bar)); // $ExpectType void
AP.confluence.onMacroPropertyPanelEvent({ '{event-type}.{control-key}.{macro-key}.macro.property-panel': () => null }); // $ExpectType void
AP.confluence.closeMacroPropertyPanel(); // $ExpectType void
AP.confluence.getContentProperty('propertyKey', property => console.log(property)); // $ExpectType void
Expand Down Expand Up @@ -62,7 +63,21 @@ editComponent.cancelCallback(false); // $ExpectType void
editComponent.cancelCallback(false, 'error'); // $ExpectType void

AP.dialog.create({ key: 'key', size: 'small', customData: { data: 1 } }); // $ExpectType Dialog
// $ExpectType Dialog
AP.dialog.create({
key: 'my-module-key',
width: '500px',
height: '200px',
chrome: true,
buttons: [
{
text: 'my button',
identifier: 'my_unique_identifier',
},
],
});
AP.dialog.close(); // $ExpectType void
AP.dialog.close({ foo: 'bar' }); // $ExpectType void
AP.dialog.getCustomData(data => console.log(data)); // $ExpectType void
AP.dialog.getButton('submit'); // $ExpectType {} | DialogButton
AP.dialog.disableCloseOnSubmit(); // $ExpectType void
Expand All @@ -83,7 +98,9 @@ AP.events.offAll('name'); // $ExpectType void
AP.events.offAllPublic('name'); // $ExpectType void
AP.events.offAny((name, data) => console.log(name, data)); // $ExpectType void
AP.events.offAnyPublic((name, data) => console.log(name, data)); // $ExpectType void
AP.events.emit('name'); // $ExpectType void
AP.events.emit('name', ['data']); // $ExpectType void
AP.events.emitPublic('name'); // $ExpectType void
AP.events.emitPublic('name', ['data']); // $ExpectType void

const flag = AP.flag.create({ title: 'title', body: 'body', type: 'info', actions: { test: 'text' } }); // $ExpectType Flag
Expand All @@ -93,6 +110,8 @@ AP.history.back(); // $ExpectType void
AP.history.forward(); // $ExpectType void
AP.history.go(-2); // $ExpectType void
AP.history.getState(); // $ExpectType string
AP.history.pushState(1); // $ExpectType void
AP.history.pushState('page2'); // $ExpectType void
AP.history.pushState({ state: 'state' }, 'title', 'https://example.com'); // $ExpectType void
AP.history.replaceState('https://example.com'); // $ExpectType void

Expand All @@ -110,6 +129,8 @@ AP.jira.showJQLEditor(obj => console.log(obj.jql), {}); // $ExpectType void
AP.jira.isNativeApp(isNative => console.log(isNative)); // $ExpectType void

AP.navigator.getLocation(location => console.log(location)); // $ExpectType void
AP.navigator.getLocation(location => console.log(location.target)); // $ExpectType void
AP.navigator.getLocation(location => console.log(location.context)); // $ExpectType void
AP.navigator.go('contentview', {}); // $ExpectType void
AP.navigator.go('issue', {}); // $ExpectType void
// $ExpectType void
Expand Down
28 changes: 21 additions & 7 deletions types/atlassian-connect-js/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ declare namespace AP {
* alert(data);
* });
*/
function getMacroData(callback: (data: object) => void): void;
// eslint-disable-next-line no-unnecessary-generics
function getMacroData<T extends object>(callback: (data: T) => void): void;

/**
* Get the body saved in the saveMacro method.
Expand Down Expand Up @@ -522,12 +523,12 @@ declare namespace AP {
/**
* if size is not set, define the width as a percentage (append a % to the number) or pixels.
*/
width?: number | undefined;
width?: number | string | undefined;

/**
* if size is not set, define the height as a percentage (append a % to the number) or pixels.
*/
height?: number | undefined;
height?: number | string | undefined;

/**
* (optional) opens the dialog with heading and buttons.
Expand Down Expand Up @@ -774,7 +775,7 @@ declare namespace AP {
* @param name The name of event to emit
* @param args 0 or more additional data arguments to deliver with the event
*/
function emit(name: string, args: string[]): void;
function emit(name: string, args?: string[]): void;

/**
* Emits a public event on this bus, firing listeners by name as well as all 'anyPublic' listeners.
Expand All @@ -785,7 +786,7 @@ declare namespace AP {
* @param name The name of event to emit
* @param args 0 or more additional data arguments to deliver with the event
*/
function emitPublic(name: string, args: string[]): void;
function emitPublic(name: string, args?: string[]): void;
}

/**
Expand Down Expand Up @@ -865,7 +866,7 @@ declare namespace AP {
* @param title
* @param url URL to add to history
*/
function pushState(newState: object, title: string, url: string): void;
function pushState(newState: any, title?: string, url?: string): void;

/**
* Updates the current entry in the session history. Updates the location's anchor with the specified value but does not change the session history. Does not invoke popState callback.
Expand Down Expand Up @@ -1233,6 +1234,19 @@ declare namespace AP {
*/
absoluteUrl: string;
}

interface NavigatorLocationContext {
/**
* The type of the page.
*/
target: NavigatorTargetJira | NavigatorTargetConfluence;

/**
* Specific information that identifies the page.
*/
context: Partial<NavigatorContext>;
}

/**
* Returns the context of the current page within the host application.
*
Expand All @@ -1247,7 +1261,7 @@ declare namespace AP {
* **contentedit** - the host application is currently editing a page, blog post or other content.
* @param callback
*/
function getLocation(callback: (location: string) => void): void;
function getLocation(callback: (location: NavigatorLocationContext) => void): void;

/**
* Navigates the user from the current page to the specified page. This call navigates the host product, not the iframe content.
Expand Down
12 changes: 6 additions & 6 deletions types/aws-sdk2-types/aws-sdk2-types-tests.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import * as AWS from 'aws-sdk2-types';
function ssm(filter: AWS.SSM.Types.ParameterStringFilter) {
return filter.Key === "Stroustrup";
return filter.Key === 'Stroustrup';
}
function rds(config: AWS.RDSDataService.ClientConfiguration) {
return config.region === "us-east-1" && !!config.computeChecksums;
return config.region === 'us-east-1' && !!config.computeChecksums;
}
function dyn(u: AWS.DynamoDB.Update, doc: AWS.DynamoDB.DocumentClient) {
if (u?.ExpressionAttributeNames) {
u.ExpressionAttributeNames["#n"] = "name";
u.ExpressionAttributeNames['#n'] = 'name';
}
doc.batchWrite({ RequestItems: { table: [{ PutRequest: { Item: { name: "Copilot" } } }] } });
doc.batchWrite({ RequestItems: { table: [{ PutRequest: { Item: { name: 'Copilot' } } }] } });
}
function s3(loc: AWS.S3.S3Location) {
return loc.StorageClass === "STANDARD";
return loc.StorageClass === 'STANDARD';
}
function sqs(x: AWS.SQS.QueueAttributeMap) {
return x["VisibilityTimeout"] === "30";
return x['VisibilityTimeout'] === '30';
}
Loading

0 comments on commit f00b0b2

Please sign in to comment.