mirror of
https://github.com/flarum/framework.git
synced 2025-02-18 08:13:15 +08: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
959662f2e2
commit
7b8d507139
18
framework/core/js/src/@types/global.d.ts
vendored
18
framework/core/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…
Reference in New Issue
Block a user