fix(lib): allow CSSStyleValue in Keyframe index signature#63437
Closed
creazyfrog wants to merge 1 commit intomicrosoft:mainfrom
Closed
fix(lib): allow CSSStyleValue in Keyframe index signature#63437creazyfrog wants to merge 1 commit intomicrosoft:mainfrom
creazyfrog wants to merge 1 commit intomicrosoft:mainfrom
Conversation
The Web Animations API is compatible with the CSS Typed Object Model: properties like `transform` accept CSSTransformValue objects (CSSRotate, CSSTranslate, etc.) at runtime in modern browsers, but the Keyframe index signature only permitted `string | number | null | undefined`. Adding CSSStyleValue — the common base class for all CSS Typed OM types — covers CSSTransformValue, CSSNumericValue, CSSKeywordValue, CSSUnitValue, and any future subclasses without needing to enumerate each one individually. Before: [property: string]: string | number | null | undefined; After: [property: string]: string | number | null | undefined | CSSStyleValue; Fixes microsoft#63325 Signed-off-by: creazyfrog <rohitcse.gec@gmail.com>
Collaborator
|
It looks like you've sent a pull request to update some generated declaration files related to the DOM. These files aren't meant to be edited by hand, as they are synchronized with files in the TypeScript-DOM-lib-generator repository. You can read more here. For house-keeping purposes, this pull request will be closed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #63325
The Web Animations API is compatible with the CSS Typed Object Model — properties like
transformcan acceptCSSTransformValueobjects (CSSRotate,CSSTranslate, etc.) at runtime in modern browsers. However, theKeyframeindex signature only allowedstring | number | null | undefined, causing a type error on valid code:Fix
Add
CSSStyleValue— the common base class for all CSS Typed OM types — to the index signature:interface Keyframe { composite?: CompositeOperationOrAuto; easing?: string; offset?: number | null; - [property: string]: string | number | null | undefined; + [property: string]: string | number | null | undefined | CSSStyleValue; }Using the base class rather than enumerating individual subclasses (
CSSTransformValue,CSSNumericValue,CSSKeywordValue, …) keeps the change minimal and future-proof — any CSS Typed OM subclass is automatically covered.Spec reference
The Web Animations spec and MDN
element.animate()confirm that CSS Typed OM values are valid for keyframe properties in supporting browsers.