Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix global typings for extensions #2992

Merged
merged 14 commits into from
Aug 19, 2021
Prev Previous commit
Next Next commit
Deprecate global app typings
  • Loading branch information
davwheat committed Jul 30, 2021
commit 7af25ae729c438fb558934f132c0119f1f687f32
24 changes: 23 additions & 1 deletion js/src/@types/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,31 @@
/**
* @deprecated Please import `app` from a namespace instead of using it as a global variable.
*
* @example App in forum JS
* ```
* import app from 'flarum/forum/app';
* ```
*
* @example App in admin JS
* ```
* import app from 'flarum/admin/app';
* ```
*/
declare const app: never;

declare const m: import('mithril').Static;
declare const app: import('../common/Application').default;
declare const dayjs: typeof import('dayjs');

// Extend JQuery with our custom functions, defined with $.fn
interface JQuery {
/**
* Flarum's tooltip JQuery plugin.
*
* Do not use this directly. Instead use the `<Tooltip>` component that
* is exported from `flarum/common/components/Tooltip`.
*
* This may be removed in a future version of Flarum.
davwheat marked this conversation as resolved.
Show resolved Hide resolved
*/
tooltip: import('./tooltips/index').TooltipJQueryFunction;
davwheat marked this conversation as resolved.
Show resolved Hide resolved
}

Expand Down