Accepted baselines.

This commit is contained in:
Daniel Rosenwasser 2015-12-23 16:53:02 -08:00
parent 64c96323aa
commit 4dc85dcbd6
2 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1,32 @@
tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStringLiteralsInJsxAttributes01.tsx(11,15): error TS2322: Type 'string' is not assignable to type '"A" | "B" | "C"'.
Type 'string' is not assignable to type '"C"'.
tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStringLiteralsInJsxAttributes01.tsx(13,15): error TS2322: Type '"f"' is not assignable to type '"A" | "B" | "C"'.
Type '"f"' is not assignable to type '"C"'.
tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStringLiteralsInJsxAttributes01.tsx(14,15): error TS2322: Type 'string' is not assignable to type '"A" | "B" | "C"'.
Type 'string' is not assignable to type '"C"'.
==== tests/cases/conformance/types/contextualTypes/jsxAttributes/contextuallyTypedStringLiteralsInJsxAttributes01.tsx (3 errors) ====
namespace JSX {
interface IntrinsicElements {
span: {};
}
}
const FooComponent = (props: { foo: "A" | "B" | "C" }) => <span>{props.foo}</span>;
<FooComponent foo={"A"} />;
<FooComponent foo="A" />;
~~~~~~~
!!! error TS2322: Type 'string' is not assignable to type '"A" | "B" | "C"'.
!!! error TS2322: Type 'string' is not assignable to type '"C"'.
<FooComponent foo={"f"} />;
~~~~~~~~~
!!! error TS2322: Type '"f"' is not assignable to type '"A" | "B" | "C"'.
!!! error TS2322: Type '"f"' is not assignable to type '"C"'.
<FooComponent foo="f" />;
~~~~~~~
!!! error TS2322: Type 'string' is not assignable to type '"A" | "B" | "C"'.
!!! error TS2322: Type 'string' is not assignable to type '"C"'.

View File

@ -0,0 +1,30 @@
//// [contextuallyTypedStringLiteralsInJsxAttributes01.tsx]
namespace JSX {
interface IntrinsicElements {
span: {};
}
}
const FooComponent = (props: { foo: "A" | "B" | "C" }) => <span>{props.foo}</span>;
<FooComponent foo={"A"} />;
<FooComponent foo="A" />;
<FooComponent foo={"f"} />;
<FooComponent foo="f" />;
//// [contextuallyTypedStringLiteralsInJsxAttributes01.jsx]
var FooComponent = function (props) { return <span>{props.foo}</span>; };
<FooComponent foo={"A"}/>;
<FooComponent foo="A"/>;
<FooComponent foo={"f"}/>;
<FooComponent foo="f"/>;
//// [contextuallyTypedStringLiteralsInJsxAttributes01.d.ts]
declare namespace JSX {
}
declare const FooComponent: (props: {
foo: "A" | "B" | "C";
}) => any;