mirror of
https://github.com/flarum/core.git
synced 2025-05-07 07:55:44 +02:00
VnodeElementTag
must be either a string or a class.
Unfortunately, TypeScript only supports strings and classes for JSX tags. Therefore, our type definition should only allow for those two types. see https://github.com/microsoft/TypeScript/issues/14789#issuecomment-412247771
This commit is contained in:
parent
b13bc70339
commit
311e858c2b
18
js/src/@types/global.d.ts
vendored
18
js/src/@types/global.d.ts
vendored
@ -21,9 +21,21 @@ declare type KeysOfType<Type extends object, Match> = {
|
||||
*/
|
||||
declare type KeyOfType<Type extends object, Match> = KeysOfType<Type, Match>[keyof Type];
|
||||
|
||||
declare type VnodeElementTag<Attrs = Record<string, unknown>, State = Record<string, unknown>> =
|
||||
| string
|
||||
| import('mithril').ComponentTypes<Attrs, State>;
|
||||
type Component<A> = import('mithril').Component<A>;
|
||||
|
||||
declare type ComponentClass<
|
||||
Attrs = Record<string, unknown>, C extends Component<Attrs> = Component<Attrs>> = { new (...args: any[]): Component<Attrs>, prototype: C };
|
||||
|
||||
/**
|
||||
* Unfortunately, TypeScript only supports strings and classes for JSX tags.
|
||||
* Therefore, our type definition should only allow for those two types.
|
||||
*
|
||||
* @see https://github.com/microsoft/TypeScript/issues/14789#issuecomment-412247771
|
||||
*/
|
||||
declare type VnodeElementTag<
|
||||
Attrs = Record<string, unknown>,
|
||||
C extends Component<Attrs> = Component<Attrs>
|
||||
> = string | ComponentClass<Attrs, C>;
|
||||
|
||||
/**
|
||||
* @deprecated Please import `app` from a namespace instead of using it as a global variable.
|
||||
|
Loading…
x
Reference in New Issue
Block a user