I have problem with writing in TypeScript & ReactJS. I have no idea how to import external libraries and use them properly in the code.
I'm trying to use
npm install --save react-autosuggest
typings install --global --save dt~react-autosuggest
import * as autosuggest from 'react-autosuggest'
error TS2497: Module ''react-autosuggest'' resolves to a non-module entity and cannot be imported using this construct.
import Autosuggest from 'react-autosuggest'
error TS1192: Module ''react-autosuggest'' has no default export.
To fix your import use require:
import AutoSuggest = require("react-autosuggest"); new AutoSuggest();
The export of the module is done with the
export = syntax. Refer to this SO for details on why you need to import this with require: http://stackoverflow.com/a/29598404/5324369