From 9258aaaa09cc0547c2ee88d3389e880942f87072 Mon Sep 17 00:00:00 2001 From: Benjamin Aster Date: Sun, 10 Dec 2023 16:53:39 +0100 Subject: [PATCH] 0.3.10 --- README.md | 4 +--- csswg/cssom.d.ts | 35 ++++++++++++++++++++++++++++++----- index.d.ts | 3 --- package.json | 2 +- tc39/array-from-async.d.ts | 2 +- tc39/array-grouping.d.ts | 12 ------------ tc39/esnext.d.ts | 11 +++++++++++ tc39/import-attributes.d.ts | 17 ----------------- test.ts | 5 +++++ whatwg/html.d.ts | 2 +- wicg/cookie-store-worker.d.ts | 2 ++ wicg/cookie-store.d.ts | 20 ++++++++++++++++---- wicg/sanitizer.d.ts | 33 --------------------------------- worker.d.ts | 2 -- 14 files changed, 68 insertions(+), 82 deletions(-) delete mode 100644 tc39/array-grouping.d.ts delete mode 100644 tc39/import-attributes.d.ts delete mode 100644 wicg/sanitizer.d.ts diff --git a/README.md b/README.md index 6e27289..0aa96b0 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # TypeScript types for new JavaScript -This repository contains TypeScript type definitions for a lot of new JavaScript stuff that isn't yet in TypeScript's standard type definitions (see below for [the complete list](#specifications-in-this-repository)). These range from the [File System Access API](https://wicg.github.io/file-system-access/) over [View Transitions](https://drafts.csswg.org/css-view-transitions-1/) to [Houdini CSS Typed OM](https://drafts.css-houdini.org/css-typed-om/) or [Handwriting Recognition](https://wicg.github.io/handwriting-recognition/). Some specifications have only partially been integrated into TypeScript's standard type declarations, in which case this repository contains only the parts of the specifications that aren't there (yet). For most specifications I have used [WebIDL2TS](https://github.com/giniedp/webidl2ts), a tool that automatically converts [WebIDL](https://webidl.spec.whatwg.org/) to TypeScript type definitions, and manually edited the stuff where it didn't generate the desired result. +This repository contains TypeScript type definitions for a lot of new JavaScript stuff that isn't yet in TypeScript's standard type definitions (see below for [the complete list](#specifications-in-this-repository)). These range from the [File System Access API](https://wicg.github.io/file-system-access/) over [View Transitions](https://drafts.csswg.org/css-view-transitions-1/) to [View Transitions](https://drafts.csswg.org/css-view-transitions-1/) or [Handwriting Recognition](https://wicg.github.io/handwriting-recognition/). Some specifications have only partially been integrated into TypeScript's standard type declarations, in which case this repository contains only the parts of the specifications that aren't there (yet). For most specifications I have used [WebIDL2TS](https://github.com/giniedp/webidl2ts), a tool that automatically converts [WebIDL](https://webidl.spec.whatwg.org/) to TypeScript type definitions, and manually edited the stuff where it didn't generate the desired result. Also take a look [Better-TypeScript](https://github.com/BenjaminAster/Better-TypeScript), which contains various TypeScript type definitions to make working with TypeScript more convenient. @@ -94,7 +94,6 @@ The type declarations in this repository include the following specifications (g - [Requesting Permissions](https://wicg.github.io/permissions-request/) - [Relinquishing Permissions](https://wicg.github.io/permissions-revoke/) - [Portals](https://wicg.github.io/portals/) - - [Sanitizer API](https://wicg.github.io/sanitizer-api/) - [Save Data API](https://wicg.github.io/savedata/) - [Shape Detection API](https://wicg.github.io/shape-detection-api/) - [Speech API](https://wicg.github.io/speech-api/) @@ -144,4 +143,3 @@ The type declarations in this repository include the following specifications (g - [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/) diff --git a/csswg/cssom.d.ts b/csswg/cssom.d.ts index 0089e8c..01b7db5 100644 --- a/csswg/cssom.d.ts +++ b/csswg/cssom.d.ts @@ -3,11 +3,10 @@ // Specification: https://drafts.csswg.org/cssom-1/ // Repository: https://github.com/w3c/csswg-drafts/tree/main/cssom-1 -// This file is auto-generated from CSSWG's CSS properties index (https://drafts.csswg.org/indexes/#properties). +// This file is auto-generated from my CSS properties index (http://localhost/webindex/css.html). // The properties already in TypeScript's standard type declarations were removed. interface CSSStyleDeclaration { - alignTracks: string; anchorDefault: string; anchorName: string; animationRange: string; @@ -27,8 +26,27 @@ interface CSSStyleDeclaration { bookmarkLabel: string; bookmarkLevel: string; bookmarkState: string; + borderBlockEndRadius: string; + borderBlockStartRadius: string; + borderBottomRadius: string; borderBoundary: string; + borderClip: string; + borderClipBottom: string; + borderClipLeft: string; + borderClipRight: string; + borderClipTop: string; + borderInlineEndRadius: string; + borderInlineStartRadius: string; + borderLeftRadius: string; + borderLimit: string; + borderRightRadius: string; + borderTopRadius: string; boxDecorationBreak: string; + boxShadowBlur: string; + boxShadowColor: string; + boxShadowOffset: string; + boxShadowPosition: string; + boxShadowSpread: string; boxSnap: string; caret: string; caretShape: string; @@ -36,12 +54,15 @@ interface CSSStyleDeclaration { contentVisibility: string; continue: string; copyInto: string; + cornerShape: string; + corners: string; cue: string; cueAfter: string; cueBefore: string; cx: string; cy: string; d: string; + fieldSizing: string; fillBreak: string; fillColor: string; fillImage: string; @@ -55,6 +76,7 @@ interface CSSStyleDeclaration { flowFrom: string; flowInto: string; fontLanguageOverride: string; + fontSynthesisPosition: string; fontVariantEmoji: string; footnoteDisplay: string; footnotePolicy: string; @@ -70,7 +92,7 @@ interface CSSStyleDeclaration { initialLetterWrap: string; inlineSizing: string; inputSecurity: string; - justifyTracks: string; + insetArea: string; layoutOrder: string; lineClamp: string; lineGrid: string; @@ -181,6 +203,8 @@ interface CSSStyleDeclaration { textSpacing: string; textSpacingTrim: string; textWrap: string; + textWrapMode: string; + textWrapStyle: string; timelineScope: string; toggle: string; toggleGroup: string; @@ -202,10 +226,11 @@ interface CSSStyleDeclaration { voiceRate: string; voiceStress: string; voiceVolume: string; + webkitAppRegion: string; + webkitTextSecurity: string; whiteSpaceCollapse: string; whiteSpaceTrim: string; - wordBoundaryDetection: string; - wordBoundaryExpansion: string; + wordSpaceTransform: string; wrapAfter: string; wrapBefore: string; wrapFlow: string; diff --git a/index.d.ts b/index.d.ts index 759ec8b..c93d28c 100644 --- a/index.d.ts +++ b/index.d.ts @@ -20,9 +20,7 @@ /// /// -/// /// -/// /// /// @@ -70,7 +68,6 @@ /// /// /// -/// /// /// /// diff --git a/package.json b/package.json index d3ea94e..4e45e85 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "new-javascript", - "version": "0.3.9", + "version": "0.3.10", "description": "TypeScript type definitions for new JavaScript stuff that isn't yet in TypeScript's standard type definitions", "main": "./index.d.ts", "repository": { diff --git a/tc39/array-from-async.d.ts b/tc39/array-from-async.d.ts index 7ff3278..968d48d 100644 --- a/tc39/array-from-async.d.ts +++ b/tc39/array-from-async.d.ts @@ -4,5 +4,5 @@ // Repository: https://github.com/tc39/proposal-array-from-async interface ArrayConstructor { - fromAsync(asyncIterable: AsyncIterable): Promise; + fromAsync(asyncIterable: AsyncIterable | Iterable): Promise; } diff --git a/tc39/array-grouping.d.ts b/tc39/array-grouping.d.ts deleted file mode 100644 index 6d8669d..0000000 --- a/tc39/array-grouping.d.ts +++ /dev/null @@ -1,12 +0,0 @@ - -// Array Grouping -// Specification: https://tc39.es/proposal-array-grouping/ -// Repository: https://github.com/tc39/proposal-array-grouping - -interface ObjectConstructor { - groupBy(array: T[], callback: (item: T, index?: number) => string): Record; -} - -interface MapConstructor { - groupBy(array: T[], callback: (item: T, index?: number) => K): Map; -} diff --git a/tc39/esnext.d.ts b/tc39/esnext.d.ts index a171666..81c156b 100644 --- a/tc39/esnext.d.ts +++ b/tc39/esnext.d.ts @@ -3,3 +3,14 @@ // Specification: https://tc39.es/ecma262/ // Repository: https://github.com/tc39/ecma262 +// Fundamental Objects +// https://tc39.es/ecma262/multipage/fundamental-objects.html + +interface ObjectConstructor { + groupBy(array: T[], callback: (item: T, index?: number) => string): Record; +} + +interface MapConstructor { + groupBy(array: T[], callback: (item: T, index?: number) => K): Map; +} + diff --git a/tc39/import-attributes.d.ts b/tc39/import-attributes.d.ts deleted file mode 100644 index b1a0a7d..0000000 --- a/tc39/import-attributes.d.ts +++ /dev/null @@ -1,17 +0,0 @@ - -// Import Attributes -// Specification: https://tc39.es/proposal-import-attributes/ -// Repository: https://github.com/tc39/proposal-import-attributes - -interface ImportCallOptions { - with?: ImportAttributes; -} - -type ImportType = ( - | "json" - | "css" -); - -interface ImportAttributes { - type?: ImportType; -} diff --git a/test.ts b/test.ts index f884464..e66e620 100644 --- a/test.ts +++ b/test.ts @@ -49,6 +49,11 @@ navigator.permissions.query({ name: "local-fonts" }) +Object.groupBy; + +import.meta.url +import.meta.resolve + // const alsjdf = Object.freeze([3]); diff --git a/whatwg/html.d.ts b/whatwg/html.d.ts index 8ccf569..a30c961 100644 --- a/whatwg/html.d.ts +++ b/whatwg/html.d.ts @@ -18,7 +18,7 @@ interface ImportMeta { } // Not-yet-standardized timezonechange event -// https://github.com/whatwg/html/pull/3047, https://docs.google.com/document/d/1gu-HAVIjVxfPQEE0uQg9Y4tJwYl33Y54DKTA9hfDyic/view +// https://github.com/whatwg/html/pull/3047, https://docs.google.com/document/d/1gu-HAVIjVxfPQEE0uQg9Y4tJwYl33Y54DKTA9hfDyic/preview interface WindowEventHandlersEventMap { "timezonechange": Event; diff --git a/wicg/cookie-store-worker.d.ts b/wicg/cookie-store-worker.d.ts index 5e376e6..3a5655e 100644 --- a/wicg/cookie-store-worker.d.ts +++ b/wicg/cookie-store-worker.d.ts @@ -8,6 +8,8 @@ /// /// +/// + interface ExtendableCookieChangeEvent extends ExtendableEvent { readonly changed: ReadonlyArray; readonly deleted: ReadonlyArray; diff --git a/wicg/cookie-store.d.ts b/wicg/cookie-store.d.ts index 31b10ec..b7b5c0b 100644 --- a/wicg/cookie-store.d.ts +++ b/wicg/cookie-store.d.ts @@ -3,7 +3,7 @@ // Specification: https://wicg.github.io/cookie-store/ // Repository: https://github.com/WICG/cookie-store -declare class CookieStore extends EventTarget { +interface CookieStore extends EventTarget { get(name: string): Promise; get(options: CookieStoreGetOptions): Promise; getAll(name: string): Promise; @@ -19,6 +19,10 @@ declare class CookieStore extends EventTarget { removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; } +declare var CookieStore: { + prototype: CookieStore; +}; + interface CookieStoreEventMap { "change": CookieChangeEvent; } @@ -61,22 +65,30 @@ interface CookieListItem { type CookieList = CookieListItem[]; -declare class CookieStoreManager { +interface CookieStoreManager { subscribe(subscriptions: CookieStoreGetOptions[]): Promise; getSubscriptions(): Promise; unsubscribe(subscriptions: CookieStoreGetOptions[]): Promise; } +declare var CookieStoreManager: { + prototype: CookieStoreManager; +}; + interface ServiceWorkerRegistration { readonly cookies: CookieStoreManager; } -declare class CookieChangeEvent extends Event { - constructor(type: string, eventInitDict?: CookieChangeEventInit); +interface CookieChangeEvent extends Event { readonly changed: ReadonlyArray; readonly deleted: ReadonlyArray; } +declare var CookieChangeEvent: { + prototype: CookieChangeEvent; + new(type: string, eventInitDict?: CookieChangeEventInit): CookieChangeEvent; +}; + interface CookieChangeEventInit extends EventInit { changed: CookieList; deleted: CookieList; diff --git a/wicg/sanitizer.d.ts b/wicg/sanitizer.d.ts deleted file mode 100644 index 6c55769..0000000 --- a/wicg/sanitizer.d.ts +++ /dev/null @@ -1,33 +0,0 @@ - -// Sanitizer API -// Specification: https://wicg.github.io/sanitizer-api/ -// Repository: https://github.com/WICG/sanitizer-api - -declare class Sanitizer { - constructor(config?: SanitizerConfig); - sanitize(input: DocumentFragment | Document): DocumentFragment; - sanitizeFor(element: string, input: string): Element | null; - getConfiguration(): SanitizerConfig; - getDefaultConfiguration(): SanitizerConfig; -} - -interface SetHTMLOptions { - sanitizer: Sanitizer; -} - -interface Element { - setHTML(input: string, options?: SetHTMLOptions): void; -} - -interface SanitizerConfig { - allowElements?: string[]; - blockElements?: string[]; - dropElements?: string[]; - allowAttributes?: AttributeMatchList; - dropAttributes?: AttributeMatchList; - allowCustomElements?: boolean; - allowComments?: boolean; -} - -declare type AttributeMatchList = Record; - diff --git a/worker.d.ts b/worker.d.ts index c7deee3..6d4fdee 100644 --- a/worker.d.ts +++ b/worker.d.ts @@ -7,9 +7,7 @@ /// /// -/// /// -/// /// ///