Skip to content

Instantly share code, notes, and snippets.

@thehappybug
Created July 10, 2018 05:45
Show Gist options
  • Save thehappybug/5c6b414c53d42b2315e166dc6aaa28ce to your computer and use it in GitHub Desktop.
Save thehappybug/5c6b414c53d42b2315e166dc6aaa28ce to your computer and use it in GitHub Desktop.
Typescript type declaration for Fuzzy Picker
declare module 'react-fuzzy-picker' {
import * as React from 'react';
export interface FuzzyPickerProps<T> {
label?: string;
displayCount?: number;
cycleAtEndsOfList?: boolean;
onChangeHighlightedItem?: (choice: T) => void;
isOpen: boolean;
onClose: () => void;
onChange: (choice: T) => void;
items: ReadonlyArray<T>;
renderItem?: (item: T) => React.ReactNode;
itemValue?: (item: T) => string;
}
export interface FuzzyWrapperProps<T> {
isKeyPressed: (ev: KeyboardEvent) => boolean;
popup: (
isOpen: FuzzyPickerProps<T>['isOpen'],
onClose: FuzzyPickerProps<T>['onClose']
) => React.ReactNode;
}
export default class FuzzyPicker<T> extends React.Component<
FuzzyPickerProps<T>
> {}
export class FuzzyWrapper<T> extends React.Component<FuzzyWrapperProps<T>> {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment