Add tests and baselines
This commit is contained in:
parent
096c15b0de
commit
fc6eee1a6c
24
tests/baselines/reference/tsxSfcReturnNull.js
Normal file
24
tests/baselines/reference/tsxSfcReturnNull.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
//// [file.tsx]
|
||||
|
||||
import React = require('react');
|
||||
|
||||
const Foo = (props: any) => null;
|
||||
|
||||
function Greet(x: {name?: string}) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const foo = <Foo />;
|
||||
const G = <Greet />;
|
||||
|
||||
//// [file.jsx]
|
||||
define(["require", "exports", "react"], function (require, exports, React) {
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var Foo = function (props) { return null; };
|
||||
function Greet(x) {
|
||||
return null;
|
||||
}
|
||||
var foo = <Foo />;
|
||||
var G = <Greet />;
|
||||
});
|
25
tests/baselines/reference/tsxSfcReturnNull.symbols
Normal file
25
tests/baselines/reference/tsxSfcReturnNull.symbols
Normal file
|
@ -0,0 +1,25 @@
|
|||
=== tests/cases/conformance/jsx/file.tsx ===
|
||||
|
||||
import React = require('react');
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
|
||||
const Foo = (props: any) => null;
|
||||
>Foo : Symbol(Foo, Decl(file.tsx, 3, 5))
|
||||
>props : Symbol(props, Decl(file.tsx, 3, 13))
|
||||
|
||||
function Greet(x: {name?: string}) {
|
||||
>Greet : Symbol(Greet, Decl(file.tsx, 3, 33))
|
||||
>x : Symbol(x, Decl(file.tsx, 5, 15))
|
||||
>name : Symbol(name, Decl(file.tsx, 5, 19))
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
const foo = <Foo />;
|
||||
>foo : Symbol(foo, Decl(file.tsx, 9, 5))
|
||||
>Foo : Symbol(Foo, Decl(file.tsx, 3, 5))
|
||||
|
||||
const G = <Greet />;
|
||||
>G : Symbol(G, Decl(file.tsx, 10, 5))
|
||||
>Greet : Symbol(Greet, Decl(file.tsx, 3, 33))
|
||||
|
30
tests/baselines/reference/tsxSfcReturnNull.types
Normal file
30
tests/baselines/reference/tsxSfcReturnNull.types
Normal file
|
@ -0,0 +1,30 @@
|
|||
=== tests/cases/conformance/jsx/file.tsx ===
|
||||
|
||||
import React = require('react');
|
||||
>React : typeof React
|
||||
|
||||
const Foo = (props: any) => null;
|
||||
>Foo : (props: any) => any
|
||||
>(props: any) => null : (props: any) => any
|
||||
>props : any
|
||||
>null : null
|
||||
|
||||
function Greet(x: {name?: string}) {
|
||||
>Greet : (x: { name?: string; }) => any
|
||||
>x : { name?: string; }
|
||||
>name : string
|
||||
|
||||
return null;
|
||||
>null : null
|
||||
}
|
||||
|
||||
const foo = <Foo />;
|
||||
>foo : JSX.Element
|
||||
><Foo /> : JSX.Element
|
||||
>Foo : (props: any) => any
|
||||
|
||||
const G = <Greet />;
|
||||
>G : JSX.Element
|
||||
><Greet /> : JSX.Element
|
||||
>Greet : (x: { name?: string; }) => any
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
//// [file.tsx]
|
||||
|
||||
import React = require('react');
|
||||
|
||||
const Foo = (props: any) => null;
|
||||
|
||||
function Greet(x: {name?: string}) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const foo = <Foo />;
|
||||
const G = <Greet />;
|
||||
|
||||
//// [file.jsx]
|
||||
define(["require", "exports", "react"], function (require, exports, React) {
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var Foo = function (props) { return null; };
|
||||
function Greet(x) {
|
||||
return null;
|
||||
}
|
||||
var foo = <Foo />;
|
||||
var G = <Greet />;
|
||||
});
|
|
@ -0,0 +1,25 @@
|
|||
=== tests/cases/conformance/jsx/file.tsx ===
|
||||
|
||||
import React = require('react');
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
|
||||
const Foo = (props: any) => null;
|
||||
>Foo : Symbol(Foo, Decl(file.tsx, 3, 5))
|
||||
>props : Symbol(props, Decl(file.tsx, 3, 13))
|
||||
|
||||
function Greet(x: {name?: string}) {
|
||||
>Greet : Symbol(Greet, Decl(file.tsx, 3, 33))
|
||||
>x : Symbol(x, Decl(file.tsx, 5, 15))
|
||||
>name : Symbol(name, Decl(file.tsx, 5, 19))
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
const foo = <Foo />;
|
||||
>foo : Symbol(foo, Decl(file.tsx, 9, 5))
|
||||
>Foo : Symbol(Foo, Decl(file.tsx, 3, 5))
|
||||
|
||||
const G = <Greet />;
|
||||
>G : Symbol(G, Decl(file.tsx, 10, 5))
|
||||
>Greet : Symbol(Greet, Decl(file.tsx, 3, 33))
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
=== tests/cases/conformance/jsx/file.tsx ===
|
||||
|
||||
import React = require('react');
|
||||
>React : typeof React
|
||||
|
||||
const Foo = (props: any) => null;
|
||||
>Foo : (props: any) => null
|
||||
>(props: any) => null : (props: any) => null
|
||||
>props : any
|
||||
>null : null
|
||||
|
||||
function Greet(x: {name?: string}) {
|
||||
>Greet : (x: { name?: string | undefined; }) => null
|
||||
>x : { name?: string | undefined; }
|
||||
>name : string | undefined
|
||||
|
||||
return null;
|
||||
>null : null
|
||||
}
|
||||
|
||||
const foo = <Foo />;
|
||||
>foo : JSX.Element
|
||||
><Foo /> : JSX.Element
|
||||
>Foo : (props: any) => null
|
||||
|
||||
const G = <Greet />;
|
||||
>G : JSX.Element
|
||||
><Greet /> : JSX.Element
|
||||
>Greet : (x: { name?: string | undefined; }) => null
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
tests/cases/conformance/jsx/file.tsx(10,13): error TS2605: JSX element type 'undefined' is not a constructor function for JSX elements.
|
||||
tests/cases/conformance/jsx/file.tsx(11,11): error TS2605: JSX element type 'undefined' is not a constructor function for JSX elements.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (2 errors) ====
|
||||
|
||||
import React = require('react');
|
||||
|
||||
const Foo = (props: any) => undefined;
|
||||
function Greet(x: {name?: string}) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Error
|
||||
const foo = <Foo />;
|
||||
~~~~~~~
|
||||
!!! error TS2605: JSX element type 'undefined' is not a constructor function for JSX elements.
|
||||
const G = <Greet />;
|
||||
~~~~~~~~~
|
||||
!!! error TS2605: JSX element type 'undefined' is not a constructor function for JSX elements.
|
|
@ -0,0 +1,25 @@
|
|||
//// [file.tsx]
|
||||
|
||||
import React = require('react');
|
||||
|
||||
const Foo = (props: any) => undefined;
|
||||
function Greet(x: {name?: string}) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Error
|
||||
const foo = <Foo />;
|
||||
const G = <Greet />;
|
||||
|
||||
//// [file.jsx]
|
||||
define(["require", "exports", "react"], function (require, exports, React) {
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var Foo = function (props) { return undefined; };
|
||||
function Greet(x) {
|
||||
return undefined;
|
||||
}
|
||||
// Error
|
||||
var foo = <Foo />;
|
||||
var G = <Greet />;
|
||||
});
|
16
tests/cases/conformance/jsx/tsxSfcReturnNull.tsx
Normal file
16
tests/cases/conformance/jsx/tsxSfcReturnNull.tsx
Normal file
|
@ -0,0 +1,16 @@
|
|||
// @filename: file.tsx
|
||||
// @jsx: preserve
|
||||
// @module: amd
|
||||
// @noLib: true
|
||||
// @libFiles: react.d.ts,lib.d.ts
|
||||
|
||||
import React = require('react');
|
||||
|
||||
const Foo = (props: any) => null;
|
||||
|
||||
function Greet(x: {name?: string}) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const foo = <Foo />;
|
||||
const G = <Greet />;
|
|
@ -0,0 +1,17 @@
|
|||
// @filename: file.tsx
|
||||
// @jsx: preserve
|
||||
// @module: amd
|
||||
// @noLib: true
|
||||
// @strictNullChecks: true
|
||||
// @libFiles: react.d.ts,lib.d.ts
|
||||
|
||||
import React = require('react');
|
||||
|
||||
const Foo = (props: any) => null;
|
||||
|
||||
function Greet(x: {name?: string}) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const foo = <Foo />;
|
||||
const G = <Greet />;
|
|
@ -0,0 +1,17 @@
|
|||
// @filename: file.tsx
|
||||
// @jsx: preserve
|
||||
// @module: amd
|
||||
// @noLib: true
|
||||
// @strictNullChecks: true
|
||||
// @libFiles: react.d.ts,lib.d.ts
|
||||
|
||||
import React = require('react');
|
||||
|
||||
const Foo = (props: any) => undefined;
|
||||
function Greet(x: {name?: string}) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Error
|
||||
const foo = <Foo />;
|
||||
const G = <Greet />;
|
Loading…
Reference in a new issue