Skip to content

Commit

Permalink
0.3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminAster committed Jul 4, 2023
1 parent 3f9e722 commit ec9a46c
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 8 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ The type declarations in this repository include the following specifications (g
- [Privacy Community Group](https://github.com/WebAudio):
- [Global Privacy Control](https://privacycg.github.io/gpc-spec/)
- [TC39](https://tc39.es):
- [Array.fromAsync](https://tc39.es/proposal-array-from-async/)
- [Array Grouping](https://tc39.es/proposal-array-grouping/)
- [ECMAScript Language Specification](https://tc39.es/ecma262/)
- [Import Attributes](https://tc39.es/proposal-import-attributes/)
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

/// <reference path="./privacycg/global-privacy-control.d.ts" />

/// <reference path="./tc39/array-from-async.d.ts" />
/// <reference path="./tc39/array-grouping.d.ts" />
/// <reference path="./tc39/esnext.d.ts" />
/// <reference path="./tc39/import-attributes.d.ts" />
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new-javascript",
"version": "0.3.4",
"version": "0.3.5",
"description": "TypeScript type definitions for new JavaScript stuff that isn't yet in TypeScript's standard type definitions",
"main": "./index.d.ts",
"repository": {
Expand Down
8 changes: 8 additions & 0 deletions tc39/array-from-async.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

// Array.fromAsync
// Specification: https://tc39.es/proposal-array-from-async/
// Repository: https://github.com/tc39/proposal-array-from-async

interface ArrayConstructor {
fromAsync<T>(asyncIterable: AsyncIterable<T>): Promise<T[]>;
}
8 changes: 5 additions & 3 deletions tc39/array-grouping.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
// Specification: https://tc39.es/proposal-array-grouping/
// Repository: https://github.com/tc39/proposal-array-grouping

interface Array<T> {
group(callback: (item: T, index?: number, array?: T[]) => string, thisArg?: any): Record<string, T[]>;
groupToMap(callback: (item: T, index?: number, array?: T[]) => string, thisArg?: any): Map<string, T[]>;
interface ObjectConstructor {
groupBy<T>(array: T[], callback: (item: T, index?: number) => string): Record<string, T[]>;
}

interface MapConstructor {
groupBy<T, K>(array: T[], callback: (item: T, index?: number) => K): Map<K, T[]>;
}
6 changes: 6 additions & 0 deletions test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
// / <reference path="./worklet/layout.d.ts" />
// / <reference path="./worklet/audio.d.ts" />

Object.fromEntries

Map.toString



CSS.lvmin

new DecompressionStream("deflate-raw");
Expand Down
14 changes: 10 additions & 4 deletions w3c/permissions-registry.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,23 @@

declare namespace NewJavaScript {
type PermissionName = (
// in lib.dom.d.ts: "geolocation", "notifications", "push", "persistent-storage", "screen-wake-lock", "xr-spatial-tracking"
// in lib.dom.d.ts:
| "geolocation"
| "notifications"
| "push"
| "persistent-storage"
| "screen-wake-lock"
| "xr-spatial-tracking"

// https://w3c.github.io/permissions-registry/#registry-table-of-standardized-permissions
// https://w3c.github.io/permissions-registry/#registry-table-of-standardized-permissions:
| "web-share"

// https://w3c.github.io/permissions-registry/#registry-table-of-provisional-permissions
// https://w3c.github.io/permissions-registry/#registry-table-of-provisional-permissions:
| "accelerometer"
| "window-management"
| "local-fonts"

// https://github.com/chromium/chromium/blob/main/third_party/blink/renderer/modules/permissions/permission_descriptor.idl
// https://github.com/chromium/chromium/blob/main/third_party/blink/renderer/modules/permissions/permission_descriptor.idl:
| "midi"
| "camera"
| "microphone"
Expand Down
1 change: 1 addition & 0 deletions worker.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

/// <reference path="./privacycg/global-privacy-control.d.ts" />

/// <reference path="./tc39/array-from-async.d.ts" />
/// <reference path="./tc39/array-grouping.d.ts" />
/// <reference path="./tc39/esnext.d.ts" />
/// <reference path="./tc39/import-attributes.d.ts" />
Expand Down
1 change: 1 addition & 0 deletions worklet/worklet-global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Worklets
// https://html.spec.whatwg.org/multipage/worklets.html

/// <reference path="../tc39/array-from-async.d.ts" />
/// <reference path="../tc39/array-grouping.d.ts" />
/// <reference path="../tc39/esnext.d.ts" />
/// <reference path="../tc39/import-attributes.d.ts" />
Expand Down

0 comments on commit ec9a46c

Please sign in to comment.