mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-10 06:41:59 -06:00
Accepted baselines.
This commit is contained in:
parent
64c96323aa
commit
4dc85dcbd6
@ -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"'.
|
||||
@ -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;
|
||||
Loading…
x
Reference in New Issue
Block a user