-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#13890 Implementing JSX.ElementType support
- Loading branch information
Antanas Arvasevicius
committed
Feb 7, 2017
1 parent
a7728f8
commit 1aee377
Showing
13 changed files
with
438 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
//// [file.tsx] | ||
declare module JSX { | ||
interface Element { } | ||
interface ElementTypeProperty { returnType; } | ||
} | ||
|
||
interface CustomType { } | ||
|
||
class Obj1 { | ||
returnType: CustomType; | ||
} | ||
const obj = <Obj1 param="123"/>; // OK | ||
|
||
const objSelfClosing = <Obj1/>; // OK | ||
|
||
const Func = () => <Obj1/>; | ||
|
||
const objFromFactory = <Func/>; // OK | ||
|
||
//// [file.jsx] | ||
var Obj1 = (function () { | ||
function Obj1() { | ||
} | ||
return Obj1; | ||
}()); | ||
var obj = <Obj1 param="123"/>; // OK | ||
var objSelfClosing = <Obj1 />; // OK | ||
var Func = function () { return <Obj1 />; }; | ||
var objFromFactory = <Func />; // OK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
=== 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, 0, 20)) | ||
|
||
interface ElementTypeProperty { returnType; } | ||
>ElementTypeProperty : Symbol(ElementTypeProperty, Decl(file.tsx, 1, 22)) | ||
>returnType : Symbol(ElementTypeProperty.returnType, Decl(file.tsx, 2, 32)) | ||
} | ||
|
||
interface CustomType { } | ||
>CustomType : Symbol(CustomType, Decl(file.tsx, 3, 1)) | ||
|
||
class Obj1 { | ||
>Obj1 : Symbol(Obj1, Decl(file.tsx, 5, 24)) | ||
|
||
returnType: CustomType; | ||
>returnType : Symbol(Obj1.returnType, Decl(file.tsx, 7, 12)) | ||
>CustomType : Symbol(CustomType, Decl(file.tsx, 3, 1)) | ||
} | ||
const obj = <Obj1 param="123"/>; // OK | ||
>obj : Symbol(obj, Decl(file.tsx, 10, 5)) | ||
>Obj1 : Symbol(Obj1, Decl(file.tsx, 5, 24)) | ||
>param : Symbol(unknown) | ||
|
||
const objSelfClosing = <Obj1/>; // OK | ||
>objSelfClosing : Symbol(objSelfClosing, Decl(file.tsx, 12, 5)) | ||
>Obj1 : Symbol(Obj1, Decl(file.tsx, 5, 24)) | ||
|
||
const Func = () => <Obj1/>; | ||
>Func : Symbol(Func, Decl(file.tsx, 14, 5)) | ||
>Obj1 : Symbol(Obj1, Decl(file.tsx, 5, 24)) | ||
|
||
const objFromFactory = <Func/>; // OK | ||
>objFromFactory : Symbol(objFromFactory, Decl(file.tsx, 16, 5)) | ||
>Func : Symbol(Func, Decl(file.tsx, 14, 5)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
=== tests/cases/conformance/jsx/file.tsx === | ||
declare module JSX { | ||
>JSX : any | ||
|
||
interface Element { } | ||
>Element : Element | ||
|
||
interface ElementTypeProperty { returnType; } | ||
>ElementTypeProperty : ElementTypeProperty | ||
>returnType : any | ||
} | ||
|
||
interface CustomType { } | ||
>CustomType : CustomType | ||
|
||
class Obj1 { | ||
>Obj1 : Obj1 | ||
|
||
returnType: CustomType; | ||
>returnType : CustomType | ||
>CustomType : CustomType | ||
} | ||
const obj = <Obj1 param="123"/>; // OK | ||
>obj : CustomType | ||
><Obj1 param="123"/> : CustomType | ||
>Obj1 : typeof Obj1 | ||
>param : any | ||
|
||
const objSelfClosing = <Obj1/>; // OK | ||
>objSelfClosing : CustomType | ||
><Obj1/> : CustomType | ||
>Obj1 : typeof Obj1 | ||
|
||
const Func = () => <Obj1/>; | ||
>Func : () => CustomType | ||
>() => <Obj1/> : () => CustomType | ||
><Obj1/> : CustomType | ||
>Obj1 : typeof Obj1 | ||
|
||
const objFromFactory = <Func/>; // OK | ||
>objFromFactory : CustomType | ||
><Func/> : CustomType | ||
>Func : () => CustomType | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
//// [file.tsx] | ||
declare module JSX { | ||
interface Element { } | ||
interface ElementTypeProperty { } | ||
} | ||
|
||
class Obj1 { | ||
} | ||
|
||
const obj = <Obj1 param="123"/>; // OK | ||
|
||
const objSelfClosing = <Obj1/>; // OK | ||
|
||
const Func = () => <Obj1/>; | ||
|
||
const objFromFactory = <Func/>; // OK | ||
|
||
|
||
//// [file.jsx] | ||
var Obj1 = (function () { | ||
function Obj1() { | ||
} | ||
return Obj1; | ||
}()); | ||
var obj = <Obj1 param="123"/>; // OK | ||
var objSelfClosing = <Obj1 />; // OK | ||
var Func = function () { return <Obj1 />; }; | ||
var objFromFactory = <Func />; // OK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
=== 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, 0, 20)) | ||
|
||
interface ElementTypeProperty { } | ||
>ElementTypeProperty : Symbol(ElementTypeProperty, Decl(file.tsx, 1, 22)) | ||
} | ||
|
||
class Obj1 { | ||
>Obj1 : Symbol(Obj1, Decl(file.tsx, 3, 1)) | ||
} | ||
|
||
const obj = <Obj1 param="123"/>; // OK | ||
>obj : Symbol(obj, Decl(file.tsx, 8, 5)) | ||
>Obj1 : Symbol(Obj1, Decl(file.tsx, 3, 1)) | ||
>param : Symbol(unknown) | ||
|
||
const objSelfClosing = <Obj1/>; // OK | ||
>objSelfClosing : Symbol(objSelfClosing, Decl(file.tsx, 10, 5)) | ||
>Obj1 : Symbol(Obj1, Decl(file.tsx, 3, 1)) | ||
|
||
const Func = () => <Obj1/>; | ||
>Func : Symbol(Func, Decl(file.tsx, 12, 5)) | ||
>Obj1 : Symbol(Obj1, Decl(file.tsx, 3, 1)) | ||
|
||
const objFromFactory = <Func/>; // OK | ||
>objFromFactory : Symbol(objFromFactory, Decl(file.tsx, 14, 5)) | ||
>Func : Symbol(Func, Decl(file.tsx, 12, 5)) | ||
|
Oops, something went wrong.