Fix getIntrinsicAttributesTypeFromJsxOpeningLikeElement
Use `getIndexTypeOfType`+`getDeclaredTypeOfSymbol` instead of `getIndexInfoOfSymbol`. Fixes #34730.
This commit is contained in:
parent
cfefe841b7
commit
20b246c83a
|
@ -22563,7 +22563,8 @@ namespace ts {
|
|||
return links.resolvedJsxElementAttributesType = getTypeOfSymbol(symbol);
|
||||
}
|
||||
else if (links.jsxFlags & JsxFlags.IntrinsicIndexedElement) {
|
||||
return links.resolvedJsxElementAttributesType = getIndexInfoOfSymbol(symbol, IndexKind.String)!.type;
|
||||
return links.resolvedJsxElementAttributesType =
|
||||
getIndexTypeOfType(getDeclaredTypeOfSymbol(symbol), IndexKind.String)!;
|
||||
}
|
||||
else {
|
||||
return links.resolvedJsxElementAttributesType = errorType;
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
//// [index.tsx]
|
||||
declare namespace JSX {
|
||||
interface IntrinsicElements extends Record<string, any> {}
|
||||
}
|
||||
|
||||
<a />;
|
||||
|
||||
|
||||
//// [index.jsx]
|
||||
<a />;
|
|
@ -0,0 +1,12 @@
|
|||
=== tests/cases/compiler/index.tsx ===
|
||||
declare namespace JSX {
|
||||
>JSX : Symbol(JSX, Decl(index.tsx, 0, 0))
|
||||
|
||||
interface IntrinsicElements extends Record<string, any> {}
|
||||
>IntrinsicElements : Symbol(IntrinsicElements, Decl(index.tsx, 0, 23))
|
||||
>Record : Symbol(Record, Decl(lib.es5.d.ts, --, --))
|
||||
}
|
||||
|
||||
<a />;
|
||||
>a : Symbol(JSX.IntrinsicElements, Decl(index.tsx, 0, 23))
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
=== tests/cases/compiler/index.tsx ===
|
||||
declare namespace JSX {
|
||||
interface IntrinsicElements extends Record<string, any> {}
|
||||
}
|
||||
|
||||
<a />;
|
||||
><a /> : error
|
||||
>a : any
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
// @jsx: preserve
|
||||
|
||||
// @filename: index.tsx
|
||||
declare namespace JSX {
|
||||
interface IntrinsicElements extends Record<string, any> {}
|
||||
}
|
||||
|
||||
<a />;
|
Loading…
Reference in a new issue