Skip to content

Commit cc1d16e

Browse files
fix: add CSSStyleValue to Keyframe and PropertyIndexedKeyframes index signatures
The Web Animations API allows passing CSS Typed Object Model values (CSSStyleValue and its subtypes like CSSUnitValue, CSSKeywordValue, CSSTransformValue, etc.) directly to animation keyframes via element.animate() and KeyframeEffect. However, the current Keyframe and PropertyIndexedKeyframes interfaces only accept string | number, causing type errors for valid CSS Typed OM usage. This adds CSSStyleValue to the index signatures of: - Keyframe: accepts CSSStyleValue for individual keyframe properties - PropertyIndexedKeyframes: accepts CSSStyleValue and CSSStyleValue[] ComputedKeyframe is intentionally left unchanged since getKeyframes() returns computed string values, not CSSStyleValue objects. Fixes microsoft/TypeScript#63325
1 parent 4a002c9 commit cc1d16e

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

baselines/dom.generated.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1386,7 +1386,7 @@ interface Keyframe {
13861386
composite?: CompositeOperationOrAuto;
13871387
easing?: string;
13881388
offset?: number | null;
1389-
[property: string]: string | number | null | undefined;
1389+
[property: string]: string | number | CSSStyleValue | null | undefined;
13901390
}
13911391

13921392
interface KeyframeAnimationOptions extends KeyframeEffectOptions {
@@ -2006,7 +2006,7 @@ interface PropertyIndexedKeyframes {
20062006
composite?: CompositeOperationOrAuto | CompositeOperationOrAuto[];
20072007
easing?: string | string[];
20082008
offset?: number | (number | null)[];
2009-
[property: string]: string | string[] | number | null | (number | null)[] | undefined;
2009+
[property: string]: string | string[] | number | CSSStyleValue | CSSStyleValue[] | null | (number | null)[] | undefined;
20102010
}
20112011

20122012
interface PublicKeyCredentialCreationOptions {

baselines/ts5.5/dom.generated.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,7 +1383,7 @@ interface Keyframe {
13831383
composite?: CompositeOperationOrAuto;
13841384
easing?: string;
13851385
offset?: number | null;
1386-
[property: string]: string | number | null | undefined;
1386+
[property: string]: string | number | CSSStyleValue | null | undefined;
13871387
}
13881388

13891389
interface KeyframeAnimationOptions extends KeyframeEffectOptions {
@@ -2003,7 +2003,7 @@ interface PropertyIndexedKeyframes {
20032003
composite?: CompositeOperationOrAuto | CompositeOperationOrAuto[];
20042004
easing?: string | string[];
20052005
offset?: number | (number | null)[];
2006-
[property: string]: string | string[] | number | null | (number | null)[] | undefined;
2006+
[property: string]: string | string[] | number | CSSStyleValue | CSSStyleValue[] | null | (number | null)[] | undefined;
20072007
}
20082008

20092009
interface PublicKeyCredentialCreationOptions {

baselines/ts5.6/dom.generated.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,7 +1383,7 @@ interface Keyframe {
13831383
composite?: CompositeOperationOrAuto;
13841384
easing?: string;
13851385
offset?: number | null;
1386-
[property: string]: string | number | null | undefined;
1386+
[property: string]: string | number | CSSStyleValue | null | undefined;
13871387
}
13881388

13891389
interface KeyframeAnimationOptions extends KeyframeEffectOptions {
@@ -2003,7 +2003,7 @@ interface PropertyIndexedKeyframes {
20032003
composite?: CompositeOperationOrAuto | CompositeOperationOrAuto[];
20042004
easing?: string | string[];
20052005
offset?: number | (number | null)[];
2006-
[property: string]: string | string[] | number | null | (number | null)[] | undefined;
2006+
[property: string]: string | string[] | number | CSSStyleValue | CSSStyleValue[] | null | (number | null)[] | undefined;
20072007
}
20082008

20092009
interface PublicKeyCredentialCreationOptions {

baselines/ts5.9/dom.generated.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,7 +1383,7 @@ interface Keyframe {
13831383
composite?: CompositeOperationOrAuto;
13841384
easing?: string;
13851385
offset?: number | null;
1386-
[property: string]: string | number | null | undefined;
1386+
[property: string]: string | number | CSSStyleValue | null | undefined;
13871387
}
13881388

13891389
interface KeyframeAnimationOptions extends KeyframeEffectOptions {
@@ -2003,7 +2003,7 @@ interface PropertyIndexedKeyframes {
20032003
composite?: CompositeOperationOrAuto | CompositeOperationOrAuto[];
20042004
easing?: string | string[];
20052005
offset?: number | (number | null)[];
2006-
[property: string]: string | string[] | number | null | (number | null)[] | undefined;
2006+
[property: string]: string | string[] | number | CSSStyleValue | CSSStyleValue[] | null | (number | null)[] | undefined;
20072007
}
20082008

20092009
interface PublicKeyCredentialCreationOptions {

inputfiles/overridingTypes.jsonc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2923,13 +2923,13 @@
29232923
"BaseKeyframe": {
29242924
"name": "Keyframe",
29252925
"overrideIndexSignatures": [
2926-
"[property: string]: string | number | null | undefined"
2926+
"[property: string]: string | number | CSSStyleValue | null | undefined"
29272927
]
29282928
},
29292929
"BasePropertyIndexedKeyframe": {
29302930
"name": "PropertyIndexedKeyframes",
29312931
"overrideIndexSignatures": [
2932-
"[property: string]: string | string[] | number | null | (number | null)[] | undefined"
2932+
"[property: string]: string | string[] | number | CSSStyleValue | CSSStyleValue[] | null | (number | null)[] | undefined"
29332933
]
29342934
},
29352935
"BaseComputedKeyframe": {

0 commit comments

Comments
 (0)