File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 6
6
* found in the LICENSE file at https://angular.io/license
7
7
*/
8
8
9
+
10
+ // Helper type that ignores `readonly` properties. This is used in
11
+ // `extendStyles` to ignore the readonly properties on CSSStyleDeclaration
12
+ // since we won't be touching those anyway.
13
+ type Writeable < T > = { - readonly [ P in keyof T ] -?: T [ P ] } ;
14
+
9
15
/**
10
16
* Extended CSSStyleDeclaration that includes a couple of drag-related
11
17
* properties that aren't in the built-in TS typings.
@@ -19,10 +25,12 @@ interface DragCSSStyleDeclaration extends CSSStyleDeclaration {
19
25
* Shallow-extends a stylesheet object with another stylesheet object.
20
26
* @docs -private
21
27
*/
22
- export function extendStyles ( dest : CSSStyleDeclaration , source : Partial < DragCSSStyleDeclaration > ) {
28
+ export function extendStyles (
29
+ dest : Writeable < CSSStyleDeclaration > ,
30
+ source : Partial < DragCSSStyleDeclaration > ) {
23
31
for ( let key in source ) {
24
32
if ( source . hasOwnProperty ( key ) ) {
25
- dest [ key ! ] = source [ key ] ;
33
+ dest [ key as keyof CSSStyleDeclaration ] = source [ key as keyof CSSStyleDeclaration ] ;
26
34
}
27
35
}
28
36
You can’t perform that action at this time.
0 commit comments