-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug
Description
TypeScript Version: 2.1.1 / nightly (2.2.0-dev.201xxxxx)
Code
// a.tsx
import React from "react";
export class SomeComponent extends React.Component<{}, {}> {
public render() {
return <div><span>Hi!</span></div>;
}
}
// b.tsx
import { SomeComponent } from "./a";
let x = <SomeComponent />; // error line
Expected behavior:
No errors - React
refers to the React
imported in a.tsx
, not a global.
Actual behavior:
error TS2686: 'React' refers to a UMD global, but the current file is a module. Consider adding an import instead
Error is on the line marked // error line
above.
The error can be subdued by adding any of the following in b.tsx
.
declare var React: any;
var React;
import React from "react";
import * as React from "react";
jcrben, NiloCK, thibaultboursier, guru-katre-mpf, adipascu and 15 more
Metadata
Metadata
Assignees
Labels
Working as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug