Typescript 1.8 now supports untyped JS files. To enable this feature, just add the compiler flag --allowJs or add "allowJs": true to compilerOptions in tsconfig.json
via https://blogs.msdn.microsoft.com/typescript/2016/01/28/announcing-typescript-1-8-beta/
I'm trying to import react-tap-event-plugin which does not have a typings file.
import * as injectTapEventPlugin from 'injectTapEventPlugin';
says module not found. So i tried:
import * as injectTapEventPlugin from '../node_modules/react-tap-event-plugin/src/injectTapEventPlugin.js';
This says Module resolves to a non-module entity and cannot be imported using this construct. And then I tried:
import injectTapEventPlugin = require('../node_modules/react-tap-event-plugin/src/injectTapEventPlugin.js');
It's crashing with ERROR in ./scripts/index.tsx
Module build failed: TypeError: Cannot read property 'kind' of undefined
at node_modules/typescript/lib/typescript.js:39567
My tsconfig:
{
"compilerOptions": {
"target": "ES5",
"removeComments": true,
"jsx": "react",
"module": "commonjs",
"sourceMap": true,
"allowJs": true
},
"exclude": [
"node_modules"
]
}
I'm using webpack with ts-loader:
{
test: /\.tsx?$/,
exclude: ['node_modules', 'tests'],
loader: 'ts-loader'
}
react-tap-event-plugin
and it's already merged. github.com/DefinitelyTyped/DefinitelyTyped/pull/8260 – Moreland