Skip to content

Commit

Permalink
0.3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
BenjaminAster committed Dec 10, 2023
1 parent 48996af commit 9258aaa
Show file tree
Hide file tree
Showing 14 changed files with 68 additions and 82 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down Expand Up @@ -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/)
Expand Down Expand Up @@ -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/)
35 changes: 30 additions & 5 deletions csswg/cssom.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -27,21 +26,43 @@ 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;
colorAdjust: string;
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;
Expand All @@ -55,6 +76,7 @@ interface CSSStyleDeclaration {
flowFrom: string;
flowInto: string;
fontLanguageOverride: string;
fontSynthesisPosition: string;
fontVariantEmoji: string;
footnoteDisplay: string;
footnotePolicy: string;
Expand All @@ -70,7 +92,7 @@ interface CSSStyleDeclaration {
initialLetterWrap: string;
inlineSizing: string;
inputSecurity: string;
justifyTracks: string;
insetArea: string;
layoutOrder: string;
lineClamp: string;
lineGrid: string;
Expand Down Expand Up @@ -181,6 +203,8 @@ interface CSSStyleDeclaration {
textSpacing: string;
textSpacingTrim: string;
textWrap: string;
textWrapMode: string;
textWrapStyle: string;
timelineScope: string;
toggle: string;
toggleGroup: string;
Expand All @@ -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;
Expand Down
3 changes: 0 additions & 3 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +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" />

/// <reference path="./w3c/ambient-light.d.ts" />
/// <reference path="./w3c/battery.d.ts" />
Expand Down Expand Up @@ -70,7 +68,6 @@
/// <reference path="./wicg/permissions-request.d.ts" />
/// <reference path="./wicg/permissions-revoke.d.ts" />
/// <reference path="./wicg/portals.d.ts" />
/// <reference path="./wicg/sanitizer.d.ts" />
/// <reference path="./wicg/save-data.d.ts" />
/// <reference path="./wicg/shape-detection.d.ts" />
/// <reference path="./wicg/speech.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.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": {
Expand Down
2 changes: 1 addition & 1 deletion tc39/array-from-async.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
// Repository: https://github.com/tc39/proposal-array-from-async

interface ArrayConstructor {
fromAsync<T>(asyncIterable: AsyncIterable<T>): Promise<T[]>;
fromAsync<T>(asyncIterable: AsyncIterable<T> | Iterable<T>): Promise<T[]>;
}
12 changes: 0 additions & 12 deletions tc39/array-grouping.d.ts

This file was deleted.

11 changes: 11 additions & 0 deletions tc39/esnext.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<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[]>;
}

17 changes: 0 additions & 17 deletions tc39/import-attributes.d.ts

This file was deleted.

5 changes: 5 additions & 0 deletions test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ navigator.permissions.query({
name: "local-fonts"
})

Object.groupBy;

import.meta.url
import.meta.resolve

// const alsjdf = Object.freeze([3]);


Expand Down
2 changes: 1 addition & 1 deletion whatwg/html.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions wicg/cookie-store-worker.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
/// <reference lib="WebWorker" />
/// <reference lib="WebWorker.Iterable" />

/// <reference path="./cookie-store.d.ts" />

interface ExtendableCookieChangeEvent extends ExtendableEvent {
readonly changed: ReadonlyArray<CookieListItem>;
readonly deleted: ReadonlyArray<CookieListItem>;
Expand Down
20 changes: 16 additions & 4 deletions wicg/cookie-store.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<CookieListItem | null>;
get(options: CookieStoreGetOptions): Promise<CookieListItem | null>;
getAll(name: string): Promise<CookieList>;
Expand All @@ -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;
}
Expand Down Expand Up @@ -61,22 +65,30 @@ interface CookieListItem {

type CookieList = CookieListItem[];

declare class CookieStoreManager {
interface CookieStoreManager {
subscribe(subscriptions: CookieStoreGetOptions[]): Promise<void>;
getSubscriptions(): Promise<CookieStoreGetOptions[]>;
unsubscribe(subscriptions: CookieStoreGetOptions[]): Promise<void>;
}

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<CookieListItem>;
readonly deleted: ReadonlyArray<CookieListItem>;
}

declare var CookieChangeEvent: {
prototype: CookieChangeEvent;
new(type: string, eventInitDict?: CookieChangeEventInit): CookieChangeEvent;
};

interface CookieChangeEventInit extends EventInit {
changed: CookieList;
deleted: CookieList;
Expand Down
33 changes: 0 additions & 33 deletions wicg/sanitizer.d.ts

This file was deleted.

2 changes: 0 additions & 2 deletions worker.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,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" />

/// <reference path="./w3c/compute-pressure.d.ts" />
/// <reference path="./w3c/device-memory.d.ts" />
Expand Down

0 comments on commit 9258aaa

Please sign in to comment.