mirror of
https://github.com/flarum/core.git
synced 2025-07-18 23:31:17 +02:00
Various TypeScript improvements (#2309)
- Use Mithril.Attributes as base for ComponentAttrs, remove =any from class signature for Component - Convert Alert to TypeScript, introduce AlertAttrs interface - Convert AlertManagerState to TypeScript, add overload signatures for `show`, introduce AlertState interface for stored Alerts. - Set ComponentAttrs as default T for Component - Make attrs in AlertAttrs optional - Add AlertIdentifier interface, simplify show type signature - Remove mithril patch shim, as all patches onto m are now deprecated - Use Mithril.Static for shim
This commit is contained in:
committed by
GitHub
parent
d2f55e941b
commit
c8cc1ed665
12
framework/core/js/shims.d.ts
vendored
12
framework/core/js/shims.d.ts
vendored
@@ -1,6 +1,5 @@
|
||||
// Mithril
|
||||
import * as Mithril from 'mithril';
|
||||
import Stream from 'mithril/stream';
|
||||
import Mithril from 'mithril';
|
||||
|
||||
// Other third-party libs
|
||||
import * as _dayjs from 'dayjs';
|
||||
@@ -9,13 +8,6 @@ import * as _$ from 'jquery';
|
||||
// Globals from flarum/core
|
||||
import Application from './src/common/Application';
|
||||
|
||||
/**
|
||||
* Helpers that flarum/core patches into Mithril
|
||||
*/
|
||||
interface m extends Mithril.Static {
|
||||
prop: typeof Stream;
|
||||
}
|
||||
|
||||
/**
|
||||
* Export Mithril typings globally.
|
||||
*
|
||||
@@ -36,7 +28,7 @@ export as namespace Mithril;
|
||||
*/
|
||||
declare global {
|
||||
const $: typeof _$;
|
||||
const m: m;
|
||||
const m: Mithril.Static;
|
||||
const dayjs: typeof _dayjs;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user