Skip to content

chore: fix implicit-any error in drag-styling.ts #13500

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 9, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/cdk/drag-drop/drag-styling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
* found in the LICENSE file at https://angular.io/license
*/


// Helper type that ignores `readonly` properties. This is used in
// `extendStyles` to ignore the readonly properties on CSSStyleDeclaration
// since we won't be touching those anyway.
type Writeable<T> = { -readonly [P in keyof T]-?: T[P] };

/**
* Extended CSSStyleDeclaration that includes a couple of drag-related
* properties that aren't in the built-in TS typings.
Expand All @@ -19,10 +25,12 @@ interface DragCSSStyleDeclaration extends CSSStyleDeclaration {
* Shallow-extends a stylesheet object with another stylesheet object.
* @docs-private
*/
export function extendStyles(dest: CSSStyleDeclaration, source: Partial<DragCSSStyleDeclaration>) {
export function extendStyles(
dest: Writeable<CSSStyleDeclaration>,
source: Partial<DragCSSStyleDeclaration>) {
for (let key in source) {
if (source.hasOwnProperty(key)) {
dest[key!] = source[key];
dest[key as keyof CSSStyleDeclaration] = source[key as keyof CSSStyleDeclaration];
}
}

Expand Down