Skip to content

Commit d25e00a

Browse files
committed
Remove no longer working type hack
Related-to: bf5ccaa.
1 parent 5271dd5 commit d25e00a

File tree

3 files changed

+511
-633
lines changed

3 files changed

+511
-633
lines changed

lib/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ function findComponentFromName(state, name, allowExpression) {
733733
// Only literals can be passed in `components` currently.
734734
// No identifiers / member expressions.
735735
if (result.type === 'Literal') {
736-
const name = /** @type {PropertyKey} */ (result.value)
736+
const name = /** @type {string | number} */ (result.value)
737737
return own.call(state.components, name) ? state.components[name] : name
738738
}
739739

lib/types.d.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -140,26 +140,26 @@ type FunctionComponent<ComponentProps> = (
140140
/**
141141
* Conditional type for a class.
142142
*/
143-
// @ts-ignore: conditionally defined.
144-
export type JsxElementClass = any extends JSX.ElementClass
145-
? unknown
146-
: // @ts-ignore: conditionally defined.
147-
JSX.ElementClass
143+
// @ts-ignore: conditionally defined;
144+
// it used to be possible to detect that with `any extends X ? X : Y`
145+
// but no longer.
146+
export type JsxElementClass = JSX.ElementClass
148147

149148
/**
150149
* Conditional type for a node object.
151150
*/
152-
// @ts-ignore: conditionally defined.
153-
export type JsxElement = any extends JSX.Element ? unknown : JSX.Element
151+
// @ts-ignore: conditionally defined;
152+
// it used to be possible to detect that with `any extends X ? X : Y`
153+
// but no longer.
154+
export type JsxElement = JSX.Element
154155

155156
/**
156157
* Conditional type for a record of tag names to corresponding props.
157158
*/
158-
// @ts-ignore: conditionally defined.
159-
export type JsxIntrinsicElements = any extends JSX.IntrinsicElements
160-
? Record<PropertyKey, any>
161-
: // @ts-ignore: conditionally defined.
162-
JSX.IntrinsicElements
159+
// @ts-ignore: conditionally defined;
160+
// it used to be possible to detect that with `any extends X ? X : Y`
161+
// but no longer.
162+
export type JsxIntrinsicElements = JSX.IntrinsicElements
163163

164164
/**
165165
* Create a development element.

0 commit comments

Comments
 (0)