Skip to content

Commit

Permalink
fix(common): Fix mouseFocusBehavior type issue (Workday#926)
Browse files Browse the repository at this point in the history
  • Loading branch information
NicholasBoll authored Dec 9, 2020
1 parent 0f34adf commit 49129f0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions modules/common/react/lib/styles/hideMouseFocus.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {CSSObject} from '@emotion/core';
import {CSSObject, Interpolation} from '@emotion/core';

/**
* A utility to hide the default canvas style focus ring when using mouse input.
Expand All @@ -14,8 +14,6 @@ export const hideMouseFocus: CSSObject = {
},
};

type IndexableObject = {[key: string]: object};

/*
* A utility that simplifies focus selectors since you can't use nested syntax for some reason. Example:
* [`[data-whatinput="mouse"],
Expand All @@ -26,8 +24,10 @@ type IndexableObject = {[key: string]: object};
}
},
*/
export const mouseFocusBehavior = <T extends IndexableObject = IndexableObject>(selectors: T) => {
const output: IndexableObject = {};
export const mouseFocusBehavior = (
selectors: Record<string, Interpolation>
): Record<string, Interpolation> => {
const output: Record<string, Interpolation> = {};

Object.keys(selectors).map((selector, index) => {
selector.split(',').forEach(selectorPart => {
Expand All @@ -39,5 +39,5 @@ export const mouseFocusBehavior = <T extends IndexableObject = IndexableObject>(
});
});

return output as T;
return output;
};

0 comments on commit 49129f0

Please sign in to comment.