ninja-keys icon indicating copy to clipboard operation
ninja-keys copied to clipboard

[typescript] type error in react

Open StringKe opened this issue 3 years ago • 4 comments

CleanShot 2022-02-16 at 15 16 47@2x


declare global {
    namespace JSX {
        interface IntrinsicElements {
            'ninja-keys': NinjaKeys
        }
    }
}

I try to add definitions, but the IDE prompts me for indeed a lot of attributes, including those of HTML elements.

CleanShot 2022-02-16 at 15 17 49@2x

StringKe avatar Feb 16 '22 07:02 StringKe

+1 here, thinking about moving to kbar

mikhael28 avatar Apr 18 '22 17:04 mikhael28

interface KBarMethods {
  open: (opts?: { parent: string }) => void;
  close: () => void;
  setParent: (parent: string) => void;
}

export interface KBarAction {
  id: string;
  title: string;
  hotkey?: string;
  handler?: Function;
  mdIcon?: string;
  icon?: string;
  parent?: string;
  keywords?: string;
  children?: string[];
  section?: string;
}

export interface KBarProps {
  hideBreadcrumbs?: boolean,
  ...
}

type KBar = Pick<HTMLElement, "addEventListener" | "removeEventListener"> &
  KBarMethods & KBarProps & { data: KBarAction[] };

declare global {
  namespace JSX {
    interface IntrinsicElements {
      ["ninja-keys"]: KBar;
    }
  }
}

wobsoriano avatar May 08 '22 08:05 wobsoriano

+1

williamleiby avatar Jun 17 '22 16:06 williamleiby

My answer didnt help @williamleiby ?

wobsoriano avatar Jun 17 '22 16:06 wobsoriano

@wobsoriano, hi do you know how to integrate this into NextJS React app?

jameswong3388 avatar Nov 16 '22 00:11 jameswong3388