Add test for non-used React import

This commit is contained in:
Ryan Cavanaugh
2016-01-01 09:24:07 -08:00
parent 7b36432cf0
commit 7aa8ba6ba7
4 changed files with 91 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
//// [tests/cases/conformance/jsx/tsxPreserveEmit3.tsx] ////
//// [file.tsx]
declare module JSX {
interface Element { }
interface IntrinsicElements {
[s: string]: any;
}
}
//// [test.d.ts]
export var React;
//// [react-consumer.tsx]
// This import should be elided
import {React} from "./test";
//// [file.jsx]
//// [react-consumer.jsx]
define(["require", "exports"], function (require, exports) {
"use strict";
});

View File

@@ -0,0 +1,25 @@
=== tests/cases/conformance/jsx/file.tsx ===
declare module JSX {
>JSX : Symbol(JSX, Decl(file.tsx, 0, 0))
interface Element { }
>Element : Symbol(Element, Decl(file.tsx, 1, 20))
interface IntrinsicElements {
>IntrinsicElements : Symbol(IntrinsicElements, Decl(file.tsx, 2, 22))
[s: string]: any;
>s : Symbol(s, Decl(file.tsx, 4, 3))
}
}
=== tests/cases/conformance/jsx/test.d.ts ===
export var React;
>React : Symbol(React, Decl(test.d.ts, 0, 10))
=== tests/cases/conformance/jsx/react-consumer.tsx ===
// This import should be elided
import {React} from "./test";
>React : Symbol(React, Decl(react-consumer.tsx, 1, 8))

View File

@@ -0,0 +1,25 @@
=== tests/cases/conformance/jsx/file.tsx ===
declare module JSX {
>JSX : any
interface Element { }
>Element : Element
interface IntrinsicElements {
>IntrinsicElements : IntrinsicElements
[s: string]: any;
>s : string
}
}
=== tests/cases/conformance/jsx/test.d.ts ===
export var React;
>React : any
=== tests/cases/conformance/jsx/react-consumer.tsx ===
// This import should be elided
import {React} from "./test";
>React : any

View File

@@ -0,0 +1,17 @@
//@jsx: preserve
//@module: amd
//@filename: file.tsx
declare module JSX {
interface Element { }
interface IntrinsicElements {
[s: string]: any;
}
}
//@filename: test.d.ts
export var React;
//@filename: react-consumer.tsx
// This import should be elided
import {React} from "./test";