diff --git a/types/ink-select-input/index.d.ts b/types/ink-select-input/index.d.ts index 2dc38d2a86..2654084e25 100644 --- a/types/ink-select-input/index.d.ts +++ b/types/ink-select-input/index.d.ts @@ -6,12 +6,12 @@ import { Component, InkComponent } from 'ink'; -export interface ItemOfSelectInput { +interface ItemOfSelectInput { label: string; value: any; } -export interface SelectInputProps { +interface SelectInputProps { focus?: boolean; indicatorComponent?: InkComponent; itemComponent?: InkComponent; @@ -20,4 +20,6 @@ export interface SelectInputProps void; } -export default class SelectInput extends Component { } +declare class SelectInput extends Component { } + +export = SelectInput; diff --git a/types/ink-select-input/ink-select-input-tests.tsx b/types/ink-select-input/ink-select-input-tests.tsx index 4120cbf43e..da29f9918e 100644 --- a/types/ink-select-input/ink-select-input-tests.tsx +++ b/types/ink-select-input/ink-select-input-tests.tsx @@ -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 = [{ - 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 ; + return ; }; diff --git a/types/ink-select-input/tsconfig.json b/types/ink-select-input/tsconfig.json index 4ae1e800aa..a3a689e150 100644 --- a/types/ink-select-input/tsconfig.json +++ b/types/ink-select-input/tsconfig.json @@ -1,5 +1,6 @@ { "compilerOptions": { + "allowSyntheticDefaultImports": true, "jsx": "react", "module": "commonjs", "lib": [