Skip to content
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

[typescript] type error in react #18

Open
StringKe opened this issue Feb 16, 2022 · 4 comments
Open

[typescript] type error in react #18

StringKe opened this issue Feb 16, 2022 · 4 comments

Comments

@StringKe
Copy link

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

@mikhael28
Copy link

+1 here, thinking about moving to kbar

@wobsoriano
Copy link
Contributor

wobsoriano commented May 8, 2022

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;
    }
  }
}

@williamleiby
Copy link

williamleiby commented Jun 17, 2022

+1

@wobsoriano
Copy link
Contributor

My answer didnt help @williamleiby ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants