Skip to content

Commit adc5d54

Browse files
committed
feat(ui): prepare types for upcoming SSG mode
1 parent 815e2be commit adc5d54

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

ui/types/feature-flag.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ export type IsFeatureEnabled<
5050
export type HasStore<T, U = {}> = IsFeatureEnabled<"store", T, U>;
5151

5252
export type HasSsr<T, U = {}> = IsFeatureEnabled<"ssr", T, U>;
53+
export type HasSsg<T, U = {}> = IsFeatureEnabled<"ssg", T, U>;
54+
export type HasSsrOrSsg<T, U = {}> = true extends QuasarFeatureFlags[
55+
| "ssr"
56+
| "ssg"]
57+
? T
58+
: U;
59+
5360
export type HasPwa<T, U = {}> = IsFeatureEnabled<"pwa", T, U>;
5461
export type HasCapacitor<T, U = {}> = IsFeatureEnabled<"capacitor", T, U>;
5562
export type HasCordova<T, U = {}> = IsFeatureEnabled<"cordova", T, U>;

ui/types/globals.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { QuasarIconSet } from "./icon-set";
2-
import { HasBex, HasCapacitor, HasCordova, HasSsr } from "./feature-flag";
2+
import { HasBex, HasCapacitor, HasCordova, HasSsrOrSsg } from "./feature-flag";
33
import { QuasarLanguage } from "./lang";
44

55
// We cannot reference directly Capacitor/Cordova types
@@ -27,7 +27,7 @@ export interface GlobalQuasarLanguage extends QuasarLanguageInstance {
2727
export interface GlobalQuasarLanguageSingleton
2828
extends
2929
Pick<GlobalQuasarLanguage, "isoName" | "nativeName" | "getLocale">,
30-
HasSsr<
30+
HasSsrOrSsg<
3131
{ set(lang: QuasarLanguage, ssrContext: any): void },
3232
{ set(lang: QuasarLanguage): void }
3333
> {
@@ -41,7 +41,7 @@ export interface GlobalQuasarIconSet extends QuasarIconSet {
4141
export interface GlobalQuasarIconSetSingleton
4242
extends
4343
QuasarIconSet,
44-
HasSsr<
44+
HasSsrOrSsg<
4545
// QSsrContext interface depends on q/app, making it available into UI package adds complexity without any real benefit
4646
{ set(iconSet: QuasarIconSet, ssrContext: any): void },
4747
{ set(iconSet: QuasarIconSet): void }
@@ -72,7 +72,7 @@ export interface QVueGlobals
7272
HasCapacitor<{ capacitor: any }>,
7373
HasBex<{ bex: GlobalsTypesHolder["bex"] }>,
7474
HasCordova<{ cordova: GlobalsTypesHolder["cordova"] }>,
75-
HasSsr<
75+
HasSsrOrSsg<
7676
{ iconMapFn?: GlobalQuasarIconMapFn; onSSRHydrated?: () => void },
7777
{ iconMapFn: GlobalQuasarIconMapFn }
7878
>,

0 commit comments

Comments
 (0)