Skip to content

Commit c2efdcf

Browse files
committed
update web-animations types based on PR review
Fixes microsoft/TypeScript#21492
1 parent 322c901 commit c2efdcf

File tree

3 files changed

+67
-17
lines changed

3 files changed

+67
-17
lines changed

baselines/dom.generated.d.ts

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14854,14 +14854,15 @@ interface EventSourceInit {
1485414854
}
1485514855

1485614856
interface AnimationOptions {
14857-
id?: DOMString;
14857+
id?: string;
1485814858
delay?: number;
1485914859
direction?: "normal" | "reverse" | "alternate" | "alternate-reverse";
1486014860
duration?: number;
1486114861
easing?: string;
1486214862
endDelay?: number;
1486314863
fill?: "none" | "forwards" | "backwards" | "both"| "auto";
1486414864
iterationStart?: number;
14865+
iterations?: number;
1486514866
}
1486614867

1486714868
interface AnimationTimeline {
@@ -14881,6 +14882,21 @@ interface AnimationEffectReadOnly {
1488114882
getComputedTiming() => ComputedTimingProperties;
1488214883
}
1488314884

14885+
interface AnimationPlaybackEventInit extends EventInit {
14886+
currentTime?: number | null;
14887+
timelineTime?: number | null;
14888+
}
14889+
14890+
interface AnimationPlaybackEvent extends Event {
14891+
readonly currentTime: number | null;
14892+
readonly timelineTime: number | null;
14893+
}
14894+
14895+
declare var AnimationPlaybackEvent: {
14896+
prototype: AnimationPlaybackEvent;
14897+
new(type: string, eventInitDict?: AnimationPlaybackEventInit): AnimationPlaybackEvent;
14898+
};
14899+
1488414900
interface Animation {
1488514901
currentTime: number | null;
1488614902
effect: AnimationEffectReadOnly;
@@ -14892,8 +14908,8 @@ interface Animation {
1489214908
readonly ready: Promise<Animation>;
1489314909
startTime: number;
1489414910
timeline: AnimationTimeline;
14895-
oncancel() => void;
14896-
oncancel() => void;
14911+
oncancel: (this: Animation, ev: AnimationPlaybackEvent) => any;
14912+
onfinish: (this: Animation, ev: AnimationPlaybackEvent) => any;
1489714913
cancel(): void;
1489814914
finish(): void;
1489914915
pause(): void;
@@ -15414,8 +15430,7 @@ type ScrollRestoration = "auto" | "manual";
1541415430
type FormDataEntryValue = string | File;
1541515431
type InsertPosition = "beforebegin" | "afterbegin" | "beforeend" | "afterend";
1541615432
type HeadersInit = Headers | string[][] | { [key: string]: string };
15417-
type DOMString = string;
15418-
type AnimationKeyFrame = {[key: string]: string | number | [string | number, string | number] | undefined};
15433+
type AnimationKeyFrame = {offset?: number | null | (number | null)[]} & {[key: string]: string | number | number[] | string[]};
1541915434
type AppendMode = "segments" | "sequence";
1542015435
type AudioContextState = "suspended" | "running" | "closed";
1542115436
type BiquadFilterType = "lowpass" | "highpass" | "bandpass" | "lowshelf" | "highshelf" | "peaking" | "notch" | "allpass";

baselines/webworker.generated.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1917,7 +1917,6 @@ type IDBValidKey = number | string | Date | IDBArrayKey;
19171917
type BufferSource = ArrayBuffer | ArrayBufferView;
19181918
type FormDataEntryValue = string | File;
19191919
type HeadersInit = Headers | string[][] | { [key: string]: string };
1920-
type DOMString = string;
19211920
type IDBCursorDirection = "next" | "nextunique" | "prev" | "prevunique";
19221921
type IDBRequestReadyState = "pending" | "done";
19231922
type IDBTransactionMode = "readonly" | "readwrite" | "versionchange";

inputfiles/addedTypes.json

Lines changed: 47 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2729,16 +2729,11 @@
27292729
"name": "onvisibilitychange",
27302730
"type": "(this: Document, ev: Event) => any"
27312731
},
2732-
{
2733-
"kind": "typedef",
2734-
"name": "DOMString",
2735-
"type": "string"
2736-
},
27372732
{
27382733
"kind": "typedef",
27392734
"flavor": "Web",
27402735
"name": "AnimationKeyFrame",
2741-
"type": "{[key: string]: string | number | [string | number, string | number] | undefined}"
2736+
"type": "{offset?: number | null | (number | null)[]} & {[key: string]: string | number | number[] | string[]}"
27422737
},
27432738
{
27442739
"kind": "interface",
@@ -2747,7 +2742,7 @@
27472742
"properties": [
27482743
{
27492744
"name": "id?",
2750-
"type": "DOMString"
2745+
"type": "string"
27512746
},
27522747
{
27532748
"name": "delay?",
@@ -2776,7 +2771,11 @@
27762771
{
27772772
"name": "iterationStart?",
27782773
"type": "number"
2779-
}
2774+
},
2775+
{
2776+
"name": "iterations?",
2777+
"type": "number"
2778+
}
27802779
]
27812780
},
27822781
{
@@ -2837,7 +2836,44 @@
28372836
]
28382837
}
28392838
]
2840-
},
2839+
},
2840+
{
2841+
"kind": "interface",
2842+
"flavor": "Web",
2843+
"name": "AnimationPlaybackEventInit",
2844+
"extends": "EventInit",
2845+
"properties": [
2846+
{
2847+
"name": "currentTime?",
2848+
"type": "number | null"
2849+
},
2850+
{
2851+
"name": "timelineTime?",
2852+
"type": "number | null"
2853+
}
2854+
]
2855+
},
2856+
{
2857+
"kind": "interface",
2858+
"flavor": "Web",
2859+
"name": "AnimationPlaybackEvent",
2860+
"extends": "Event",
2861+
"constructorSignatures": [
2862+
"new(type: string, eventInitDict?: AnimationPlaybackEventInit): AnimationPlaybackEvent"
2863+
],
2864+
"properties": [
2865+
{
2866+
"readonly": true,
2867+
"name": "currentTime",
2868+
"type": "number | null"
2869+
},
2870+
{
2871+
"readonly": true,
2872+
"name": "timelineTime",
2873+
"type": "number | null"
2874+
}
2875+
]
2876+
},
28412877
{
28422878
"kind": "interface",
28432879
"flavor": "Web",
@@ -2895,13 +2931,13 @@
28952931
{
28962932
"name": "oncancel",
28972933
"signatures": [
2898-
"oncancel() => void"
2934+
"oncancel: (this: Animation, ev: AnimationPlaybackEvent) => any"
28992935
]
29002936
},
29012937
{
29022938
"name": "onfinish",
29032939
"signatures": [
2904-
"oncancel() => void"
2940+
"onfinish: (this: Animation, ev: AnimationPlaybackEvent) => any"
29052941
]
29062942
},
29072943
{

0 commit comments

Comments
 (0)