I was very excited about the latest TypeScript 2.1.4 release in that a big factor in convincing my team to use TS is the ability to import an installed module without having to find or create type definitions for it, which implicit any imports provide. For some reason, however, this doesn't seem to be working as advertised, as I still get error messages telling me that a module cannot be found. When I install types for my module (React in this case) it works just fine.
Here's my package.json:
{
"name": "my_app_name",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "webpack-dev-server --colors --port 8282"
},
"dependencies": {
"react": "^15.4.1",
"react-dom": "^15.4.1"
},
"devDependencies": {
"awesome-typescript-loader": "^3.0.0-beta.9",
"source-map-loader": "^0.1.5",
"typescript": "^2.1.4",
"webpack": "^1.14.0",
"webpack-dev-server": "^1.16.2"
}
}
My tsconfig.json:
{
"compilerOptions": {
"outDir": "./dist/",
"module": "commonjs",
"target": "esnext",
"jsx": "react"
},
"include": [
"./**/*"
]
}
And a sample .tsx file for a React component that replicates this issue:
import * as React from "react";
export interface HelloProps { compiler: string; framework: string; }
export const Hello = (props: HelloProps) => {
return <h1>Hello from {props.compiler} and {this.props.framework}!</h1>
};
I also went ahead and created another project replicating this issue and uploaded it to BitBucket for anyone interested. Any help would be greatly appreciated. If this turns out to be an issue with TypeScript itself, I'll make sure to create an Issue on the Github repo.