Skip to content

Commit

Permalink
fix: type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
atomiks committed Mar 3, 2021
1 parent 1396929 commit bba0afa
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .config/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ module.exports = {
'@typescript-eslint/array-type': 'off',
'@typescript-eslint/no-empty-function': 'off',
'@typescript-eslint/ban-ts-ignore': 'off',
'@typescript-eslint/ban-ts-comment': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
},
ignorePatterns: [
'node_modules',
Expand Down
2 changes: 1 addition & 1 deletion src/addons/createSingleton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {applyStyles, Modifier} from '@popperjs/core';
// every time the popper is destroyed (i.e. a new target), removing the styles
// and causing transitions to break for singletons when the console is open, but
// most notably for non-transform styles being used, `gpuAcceleration: false`.
const applyStylesModifier: Modifier<'applyStyles', {}> = {
const applyStylesModifier: Modifier<'applyStyles', Record<string, unknown>> = {
...applyStyles,
effect({state}) {
const initialStyles = {
Expand Down
2 changes: 1 addition & 1 deletion src/addons/delegate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function delegate(
node: Element,
eventType: string,
handler: EventListener,
options: object | boolean = false
options: boolean | Record<string, unknown> = false
): void {
node.addEventListener(eventType, handler, options);
listeners.push({node, eventType, handler, options});
Expand Down
6 changes: 3 additions & 3 deletions src/createTippy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ export default function createTippy(
function on(
eventType: string,
handler: EventListener,
options: boolean | object = false
options: boolean | Record<string, unknown> = false
): void {
const nodes = normalizeToArray(instance.props.triggerTarget || reference);
nodes.forEach((node) => {
Expand Down Expand Up @@ -602,7 +602,7 @@ export default function createTippy(
}
: reference;

const tippyModifier: Modifier<'$$tippy', {}> = {
const tippyModifier: Modifier<'$$tippy', Record<string, unknown>> = {
name: '$$tippy',
enabled: true,
phase: 'beforeWrite',
Expand All @@ -628,7 +628,7 @@ export default function createTippy(
},
};

type TippyModifier = Modifier<'$$tippy', {}>;
type TippyModifier = Modifier<'$$tippy', Record<string, unknown>>;
type ExtendedModifiers = StrictModifiers | Partial<TippyModifier>;

const modifiers: Array<ExtendedModifiers> = [
Expand Down
5 changes: 4 additions & 1 deletion src/plugins/inlinePositioning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ const inlinePositioning: InlinePositioning = {
let cursorRectIndex = -1;
let isInternalUpdate = false;

const modifier: Modifier<'tippyInlinePositioning', {}> = {
const modifier: Modifier<
'tippyInlinePositioning',
Record<string, unknown>
> = {
name: 'tippyInlinePositioning',
enabled: true,
phase: 'afterWrite',
Expand Down
2 changes: 1 addition & 1 deletion src/types-internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export interface ListenerObject {
node: Element;
eventType: string;
handler: EventListenerOrEventListenerObject;
options: boolean | object;
options: boolean | Record<string, unknown>;
}

export interface PopperTreeData {
Expand Down
5 changes: 4 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import {BasePlacement, Placement} from './types';

export function hasOwnProperty(obj: object, key: string): boolean {
export function hasOwnProperty(
obj: Record<string, unknown>,
key: string
): boolean {
return {}.hasOwnProperty.call(obj, key);
}

Expand Down

0 comments on commit bba0afa

Please sign in to comment.