diff --git a/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes01.errors.txt b/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes01.errors.txt new file mode 100644 index 00000000000..99bb5d6daf5 --- /dev/null +++ b/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes01.errors.txt @@ -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" }) => {props.foo}; + + ; + ; + ~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type '"A" | "B" | "C"'. +!!! error TS2322: Type 'string' is not assignable to type '"C"'. + + ; + ~~~~~~~~~ +!!! error TS2322: Type '"f"' is not assignable to type '"A" | "B" | "C"'. +!!! error TS2322: Type '"f"' is not assignable to type '"C"'. + ; + ~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type '"A" | "B" | "C"'. +!!! error TS2322: Type 'string' is not assignable to type '"C"'. \ No newline at end of file diff --git a/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes01.js b/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes01.js new file mode 100644 index 00000000000..c21247c2835 --- /dev/null +++ b/tests/baselines/reference/contextuallyTypedStringLiteralsInJsxAttributes01.js @@ -0,0 +1,30 @@ +//// [contextuallyTypedStringLiteralsInJsxAttributes01.tsx] + +namespace JSX { + interface IntrinsicElements { + span: {}; + } +} + +const FooComponent = (props: { foo: "A" | "B" | "C" }) => {props.foo}; + +; +; + +; +; + +//// [contextuallyTypedStringLiteralsInJsxAttributes01.jsx] +var FooComponent = function (props) { return {props.foo}; }; +; +; +; +; + + +//// [contextuallyTypedStringLiteralsInJsxAttributes01.d.ts] +declare namespace JSX { +} +declare const FooComponent: (props: { + foo: "A" | "B" | "C"; +}) => any;