ealush / emoji-picker-react

The most popular React Emoji Picker
https://ealush.com/emoji-picker-react/
MIT License
1.1k stars 177 forks source link

Typescript Declarations #136

Closed centrual closed 4 years ago

centrual commented 4 years ago

Hello,

I written typescript declaration file for my own project. It can help to people:

emoji-picker-react.d.ts

declare module 'emoji-picker-react' {
  import React from "react";

  export const SKIN_TONE_NEUTRAL = 'neutral';
  export const SKIN_TONE_LIGHT = '1f3fb';
  export const SKIN_TONE_MEDIUM_LIGHT = '1f3fc';
  export const SKIN_TONE_MEDIUM = '1f3fe';
  export const SKIN_TONE_MEDIUM_DARK = '1f3ff';
  export const SKIN_TONE_DARK = '1f3fd';

  export interface IEmojiData {
    unified: string,
    originalUnified: string,
    names: Array<string>,
    emoji: string,
    activeSkinTone: string
  }

  export interface IEmojiPickerProps {
    onEmojiClick: Function,
    emojiUrl?: string,
    preload?: boolean,
    skinTone?: SKIN_TONE_NEUTRAL | SKIN_TONE_LIGHT | SKIN_TONE_MEDIUM_LIGHT | SKIN_TONE_MEDIUM | SKIN_TONE_MEDIUM_DARK | SKIN_TONE_DARK
  }

  const EmojiPicker: React.FC<IEmojiPickerProps> = (props: IEmojiPickerProps) => {};
  export default EmojiPicker;
}
ealush commented 4 years ago

Hey @centrual, that's really awesome! One thing though, I see that you are exporting the IEmojiData interface, instead of using it in onEmojiClick. Is that intentional?

Anyway, other than that it looks really good. I want to add it as a part of the library. Would you mind opening a PR with adding the typings file? You can add it to the root folder, and name it emoji-picker-react.d.ts.

Thank you 👍

centrual commented 4 years ago

Hey @ealush

You're right about the IEmojiData interface. I changed it and opened PR about that: https://github.com/ealush/emoji-picker-react/pull/137

Thank you too. Have a great day :)

ealush commented 4 years ago

Amazing. Merged :)