typed-typings/npm-react-router

Cannot find namespace JSX

orif opened this issue · 4 comments

orif commented

typings,json

{
  "dependencies": {
    "lodash": "registry:npm/lodash#4.0.0+20160701205107",
    "react": "registry:npm/react#15.0.1+20160601175240",
    "react-dom": "registry:npm/react-dom#15.0.1+20160705210405",
    "react-router": "registry:npm/react-router#2.4.0+20160628165748"
  },
  "globalDependencies": {
    "react-bootstrap": "registry:dt/react-bootstrap#0.0.0+20160706182032",
    "whatwg-fetch": "registry:dt/whatwg-fetch#0.0.0+20160524142046"
  }
}

Failing lines:
createElement?<IProps>(component: ReactComponent<IProps>, props: IProps): JSX.Element;
or
render?<IProps>(props: IProps): JSX.Element;

I ran into this issue today as well. See typings/registry#619 for more details.

I think this is because the typings.json was outdated (using ambient instead of global)

orif commented

I think this issue is still valid. I just checked with the latest versions of above-mentioned typings. I fixed the issue on my machine by adding back JSX namespace from dt~react typings (which in turn required React namespace to be global as well); it looks like TypeScript (or Visual Studio) depends on JSX namespace for intellisense and coloring.

What I mean is the JSX comes from react. As you said it is from dt~react typings. So it is not really an issue of this react-router, but getting the right dependency. Thus fixing the typings.json would solve the problem.