Add testcase for #3764

This commit is contained in:
Ryan Cavanaugh 2015-07-07 11:01:34 -07:00
parent f682980216
commit 1a8200fea7
4 changed files with 114 additions and 0 deletions

View File

@ -0,0 +1,36 @@
//// [tests/cases/conformance/jsx/tsxElementResolution19.tsx] ////
//// [react.d.ts]
declare module "react" {
}
//// [file1.tsx]
declare module JSX {
interface Element { }
}
export class MyClass { }
//// [file2.tsx]
// Should not elide React import
import * as React from 'react';
import {MyClass} from './file1';
<MyClass />;
//// [file1.js]
define(["require", "exports"], function (require, exports) {
var MyClass = (function () {
function MyClass() {
}
return MyClass;
})();
exports.MyClass = MyClass;
});
//// [file2.js]
define(["require", "exports", './file1'], function (require, exports, file1_1) {
React.createElement(file1_1.MyClass, null);
});

View File

@ -0,0 +1,28 @@
=== tests/cases/conformance/jsx/react.d.ts ===
No type information for this code.declare module "react" {
No type information for this code.
No type information for this code.}
No type information for this code.
No type information for this code.=== tests/cases/conformance/jsx/file1.tsx ===
declare module JSX {
>JSX : Symbol(JSX, Decl(file1.tsx, 0, 0))
interface Element { }
>Element : Symbol(Element, Decl(file1.tsx, 0, 20))
}
export class MyClass { }
>MyClass : Symbol(MyClass, Decl(file1.tsx, 2, 1))
=== tests/cases/conformance/jsx/file2.tsx ===
// Should not elide React import
import * as React from 'react';
>React : Symbol(React, Decl(file2.tsx, 2, 6))
import {MyClass} from './file1';
>MyClass : Symbol(MyClass, Decl(file2.tsx, 3, 8))
<MyClass />;
>MyClass : Symbol(MyClass, Decl(file2.tsx, 3, 8))

View File

@ -0,0 +1,29 @@
=== tests/cases/conformance/jsx/react.d.ts ===
No type information for this code.declare module "react" {
No type information for this code.
No type information for this code.}
No type information for this code.
No type information for this code.=== tests/cases/conformance/jsx/file1.tsx ===
declare module JSX {
>JSX : any
interface Element { }
>Element : Element
}
export class MyClass { }
>MyClass : MyClass
=== tests/cases/conformance/jsx/file2.tsx ===
// Should not elide React import
import * as React from 'react';
>React : typeof React
import {MyClass} from './file1';
>MyClass : typeof MyClass
<MyClass />;
><MyClass /> : any
>MyClass : typeof MyClass

View File

@ -0,0 +1,21 @@
//@jsx: react
//@module: amd
//@filename: react.d.ts
declare module "react" {
}
//@filename: file1.tsx
declare module JSX {
interface Element { }
}
export class MyClass { }
//@filename: file2.tsx
// Should not elide React import
import * as React from 'react';
import {MyClass} from './file1';
<MyClass />;