mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 12:30:18 +00:00
Do not use default export, align indentation
This commit is contained in:
Vendored
+5
-3
@@ -6,12 +6,12 @@
|
||||
|
||||
import { Component, InkComponent } from 'ink';
|
||||
|
||||
export interface ItemOfSelectInput {
|
||||
interface ItemOfSelectInput {
|
||||
label: string;
|
||||
value: any;
|
||||
}
|
||||
|
||||
export interface SelectInputProps<T extends ItemOfSelectInput = ItemOfSelectInput> {
|
||||
interface SelectInputProps<T extends ItemOfSelectInput = ItemOfSelectInput> {
|
||||
focus?: boolean;
|
||||
indicatorComponent?: InkComponent;
|
||||
itemComponent?: InkComponent;
|
||||
@@ -20,4 +20,6 @@ export interface SelectInputProps<T extends ItemOfSelectInput = ItemOfSelectInpu
|
||||
onSelect?: (item: T) => void;
|
||||
}
|
||||
|
||||
export default class SelectInput extends Component<SelectInputProps> { }
|
||||
declare class SelectInput extends Component<SelectInputProps> { }
|
||||
|
||||
export = SelectInput;
|
||||
|
||||
@@ -1,27 +1,32 @@
|
||||
/** @jsx h */
|
||||
import { h, InkComponent } from 'ink';
|
||||
import SelectInput from 'ink-select-input';
|
||||
// NOTE: `import SelectInput = require('ink-select-input');` will work as well.
|
||||
// If importing using ES6 default import as above,
|
||||
// `allowSyntheticDefaultImports` flag in compiler options needs to be set to `true`
|
||||
|
||||
interface DemoItem {
|
||||
label: string;
|
||||
value: string;
|
||||
label: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
const items: ReadonlyArray<DemoItem> = [{
|
||||
label: 'First',
|
||||
value: 'first'
|
||||
}, {
|
||||
label: 'Second',
|
||||
value: 'second'
|
||||
}, {
|
||||
label: 'Third',
|
||||
value: 'third'
|
||||
label: 'First',
|
||||
value: 'first'
|
||||
},
|
||||
{
|
||||
label: 'Second',
|
||||
value: 'second'
|
||||
},
|
||||
{
|
||||
label: 'Third',
|
||||
value: 'third'
|
||||
}];
|
||||
|
||||
const Demo: InkComponent = () => {
|
||||
const handleSelect = (item: DemoItem) => {
|
||||
console.log(item);
|
||||
};
|
||||
const handleSelect = (item: DemoItem) => {
|
||||
console.log(item);
|
||||
};
|
||||
|
||||
return <SelectInput items={items} onSelect={handleSelect} />;
|
||||
return <SelectInput items={items} onSelect={handleSelect} />;
|
||||
};
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"jsx": "react",
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
|
||||
Reference in New Issue
Block a user