mirror of
https://github.com/flarum/framework.git
synced 2025-01-20 15:46:16 +08:00
Format and Type Import Cleanup
Co-authored-by: David Wheatley <hi@davwheat.dev>
This commit is contained in:
parent
2dea2f09a4
commit
a82a160ecb
13
framework/core/js/src/@types/global.d.ts
vendored
13
framework/core/js/src/@types/global.d.ts
vendored
|
@ -23,19 +23,18 @@ declare type KeyOfType<Type extends object, Match> = KeysOfType<Type, Match>[key
|
|||
|
||||
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 };
|
||||
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>;
|
||||
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.
|
||||
|
|
|
@ -4,7 +4,7 @@ import LoadingIndicator from '../../common/components/LoadingIndicator';
|
|||
import Placeholder from '../../common/components/Placeholder';
|
||||
import ExtensionReadme from '../models/ExtensionReadme';
|
||||
import type Mithril from 'mithril';
|
||||
import { Extension } from '../AdminApplication';
|
||||
import type { Extension } from '../AdminApplication';
|
||||
|
||||
export interface IReadmeModalAttrs extends IInternalModalAttrs {
|
||||
extension: Extension;
|
||||
|
|
|
@ -6,9 +6,9 @@ import Group from '../models/Group';
|
|||
import extractText from '../utils/extractText';
|
||||
import ItemList from '../utils/ItemList';
|
||||
import Stream from '../utils/Stream';
|
||||
import Mithril from 'mithril';
|
||||
import User from '../models/User';
|
||||
import { SaveAttributes, SaveRelationships } from '../Model';
|
||||
import type Mithril from 'mithril';
|
||||
import type User from '../models/User';
|
||||
import type { SaveAttributes, SaveRelationships } from '../Model';
|
||||
|
||||
export interface IEditUserModalAttrs extends IInternalModalAttrs {
|
||||
user: User;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import RequestError from '../utils/RequestError';
|
||||
import type RequestError from '../utils/RequestError';
|
||||
import Modal, { IInternalModalAttrs } from './Modal';
|
||||
|
||||
export interface IRequestErrorModalAttrs extends IInternalModalAttrs {
|
||||
error: RequestError;
|
||||
formattedError: string[];
|
||||
};
|
||||
}
|
||||
|
||||
export default class RequestErrorModal<CustomAttrs extends IRequestErrorModalAttrs = IRequestErrorModalAttrs> extends Modal<CustomAttrs> {
|
||||
className() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import Component from '../Component';
|
||||
import type Component from '../Component';
|
||||
import Modal from '../components/Modal';
|
||||
|
||||
/**
|
||||
|
@ -8,7 +8,7 @@ import Modal from '../components/Modal';
|
|||
* https://github.com/Microsoft/TypeScript/issues/1213
|
||||
* Therefore, we have to use this ugly, messy workaround.
|
||||
*/
|
||||
type UnsafeModalClass = ComponentClass<any, Modal> & {isDismissible: boolean, component: typeof Component.component};
|
||||
type UnsafeModalClass = ComponentClass<any, Modal> & { isDismissible: boolean; component: typeof Component.component };
|
||||
|
||||
/**
|
||||
* Class used to manage modal state.
|
||||
|
|
Loading…
Reference in New Issue
Block a user