user3091275 user3091275 - 1 year ago 116
React JSX Question

Material-UI dependencies: ''react-tap-event-plugin'' has no exported member 'injectTapEventPlugin'

I'm working with react/typescript/material-ui/webpack. Material-UI has a dependency to

and I am having issues importing the injectTapEventPlugin function, here is the error I got:

error TS2305: Module ''react-tap-event-plugin'' has no exported member 'injectTapEventPlugin'.

To add the definition for
I used the following command:

sudo typings install dt~react-tap-event-plugin --save --global --save-dev

The index.d.ts looks like this:

declare module 'react-tap-event-plugin'{
interface StrategyOverrides {
shouldRejectClick?: (lastTouchEventTimestamp: Date, clickEventTimestamp: Date) => boolean;

var injectTapEventPlugin: (strategyOverrides?: StrategyOverrides) => void;

export = injectTapEventPlugin;

I am trying to import the plugin in my App using:

import {injectTapEventPlugin} from 'react-tap-event-plugin';

Any idea on what I am missing?

Answer Source

Taken from the test file in the github project

// since the export is a function, this is the only actual correct way:
import injectTapEventPluginRequire = require("react-tap-event-plugin");