TypeScript/tests/baselines/reference/jsxNamespacePrefixIntrinsics.errors.txt
Thomas Williamson 8ed251d0c7
Support xml namespace prefix for JSX elements and attributes (#37421)
* Support xml namespace prefix for JSX elements and attributes

Just as with the `-` character, `:` is now also treated specially in JSX
element and attribute names, but is only allowed a single time, and not
at the beginning or end of the name, as is specified in the JSX spec.
All tests in jsxInvalidEsprimaTestSuite still fail, but for slightly
different reasons now. Two lines in jsxEsprimaFbTestSuite were
uncommented as they included elements with namespaces, and they now pass
without error.

* Add case for colons at ends of identifier

* Add case for jsx namepsace intrinsics

* Add cases with upcase idents for jsx namespaces

* Add case for jsx namespaces with react option

* Always consider jsx names with colon to be intrinsics

* Adjust comment about chars valid in jsx names but not js idents

* Fix minor typo in namespace prefix test case variable name

* Remove misleading comments on isUnhyphenatedJsxName
2020-11-02 15:34:36 -08:00

34 lines
1.9 KiB
Plaintext

tests/cases/compiler/jsxNamespacePrefixIntrinsics.tsx(15,18): error TS2339: Property 'element' does not exist on type 'JSX.IntrinsicElements'.
tests/cases/compiler/jsxNamespacePrefixIntrinsics.tsx(16,30): error TS2322: Type '{ attribute: string; }' is not assignable to type '{ "ns:attribute": string; }'.
Property 'attribute' does not exist on type '{ "ns:attribute": string; }'.
tests/cases/compiler/jsxNamespacePrefixIntrinsics.tsx(17,30): error TS2322: Type '{ "ns:invalid": string; }' is not assignable to type '{ "ns:attribute": string; }'.
Property 'ns:invalid' does not exist on type '{ "ns:attribute": string; }'.
==== tests/cases/compiler/jsxNamespacePrefixIntrinsics.tsx (3 errors) ====
declare namespace JSX {
interface IntrinsicElements {
"ns:element": {
"ns:attribute": string;
},
"ns:NamespacedUpcaseAlsoIntrinsic": any,
"NS:NamespacedUpcaseAlsoIntrinsic": any
}
}
const valid = <ns:element ns:attribute="yep" />;
const validUpcase1 = <ns:NamespacedUpcaseAlsoIntrinsic />;
const validUpcase2 = <NS:NamespacedUpcaseAlsoIntrinsic />;
const invalid1 = <element />;
~~~~~~~~~~~
!!! error TS2339: Property 'element' does not exist on type 'JSX.IntrinsicElements'.
const invalid2 = <ns:element attribute="nope" />;
~~~~~~~~~
!!! error TS2322: Type '{ attribute: string; }' is not assignable to type '{ "ns:attribute": string; }'.
!!! error TS2322: Property 'attribute' does not exist on type '{ "ns:attribute": string; }'.
const invalid3 = <ns:element ns:invalid="nope" />;
~~~~~~~~~~
!!! error TS2322: Type '{ "ns:invalid": string; }' is not assignable to type '{ "ns:attribute": string; }'.
!!! error TS2322: Property 'ns:invalid' does not exist on type '{ "ns:attribute": string; }'.