From d4fc9b5ba515a5ad143a78b5af237ac1be0a6cbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mi=C5=A1ko=20Hevery?= Date: Thu, 14 Dec 2023 20:58:52 +0000 Subject: [PATCH] fix(qwik): restore bivarience hack --- .github/workflows/ci.yml | 14 +++++++------- packages/qwik/src/core/api.md | 7 +++++-- packages/qwik/src/core/qrl/qrl-class.ts | 2 +- packages/qwik/src/core/qrl/qrl.public.ts | 23 ++++++++++++----------- 4 files changed, 25 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 42c19247447..bd811809bb2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -118,7 +118,7 @@ jobs: run: tree packages/qwik/dist/ - name: Upload Qwik Build Artifacts - uses: actions/upload-artifact@master + uses: actions/upload-artifact@v3 with: name: dist-dev-builder-io-qwik path: packages/qwik/dist/ @@ -128,7 +128,7 @@ jobs: run: tree packages/create-qwik/dist/ - name: Upload Create Qwik CLI Build Artifacts - uses: actions/upload-artifact@master + uses: actions/upload-artifact@v3 with: name: dist-dev-create-qwik path: packages/create-qwik/dist/ @@ -141,7 +141,7 @@ jobs: run: tree packages/eslint-plugin-qwik/dist/ - name: Upload Eslint rules Build Artifacts - uses: actions/upload-artifact@master + uses: actions/upload-artifact@v3 with: name: dist-dev-eslint-plugin-qwik path: packages/eslint-plugin-qwik/dist/ @@ -220,7 +220,7 @@ jobs: - name: Upload WASM Build Artifacts if: ${{ needs.changes.outputs.fullbuild == 'true' }} - uses: actions/upload-artifact@master + uses: actions/upload-artifact@v3 with: name: dist-bindings-wasm path: packages/qwik/dist/bindings/* @@ -455,7 +455,7 @@ jobs: - name: Upload Qwik Distribution Artifact if: ${{ needs.changes.outputs.fullbuild == 'true' }} - uses: actions/upload-artifact@master + uses: actions/upload-artifact@v3 with: name: builderio-qwik-distribution path: packages/qwik/dist/* @@ -471,7 +471,7 @@ jobs: - name: Upload QwikCity Build Artifacts if: ${{ needs.changes.outputs.fullbuild == 'true' }} - uses: actions/upload-artifact@master + uses: actions/upload-artifact@v3 with: name: builderio-qwikcity-distribution path: packages/qwik-city/lib/ @@ -483,7 +483,7 @@ jobs: - name: Upload QwikLabs Build Artifacts if: ${{ needs.changes.outputs.fullbuild == 'true' }} - uses: actions/upload-artifact@master + uses: actions/upload-artifact@v3 with: name: builderio-qwiklabs-distribution path: | diff --git a/packages/qwik/src/core/api.md b/packages/qwik/src/core/api.md index db1543460fb..6c3caefd91f 100644 --- a/packages/qwik/src/core/api.md +++ b/packages/qwik/src/core/api.md @@ -609,18 +609,21 @@ export type PropsOf = COMP extends Component ? NonNullable> = TransformProps & ComponentBaseProps & ComponentChildren; +// Warning: (ae-forgotten-export) The symbol "BivariantQrlFn" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "QrlArgs" needs to be exported by the entry point index.d.ts +// Warning: (ae-forgotten-export) The symbol "QrlReturn" needs to be exported by the entry point index.d.ts +// // @public export type QRL = { __qwik_serializable__?: any; __brand__QRL__: TYPE; - (...args: TYPE extends (...args: infer ARGS) => any ? ARGS : never): Promise infer RETURN ? Awaited : never>; resolve(): Promise; resolved: undefined | TYPE; getCaptured(): unknown[] | null; getSymbol(): string; getHash(): string; dev: QRLDev | null; -}; +} & BivariantQrlFn, QrlReturn>; // @public export const qrl: (chunkOrFn: string | (() => Promise), symbol: string, lexicalScopeCapture?: any[], stackOffset?: number) => QRL; diff --git a/packages/qwik/src/core/qrl/qrl-class.ts b/packages/qwik/src/core/qrl/qrl-class.ts index 8af140ec7a8..1bda78d17e5 100644 --- a/packages/qwik/src/core/qrl/qrl-class.ts +++ b/packages/qwik/src/core/qrl/qrl-class.ts @@ -73,7 +73,7 @@ export const createQRL = ( const fn = invokeFn.call(this, tryGetInvokeContext()); const result = await fn(...args); return result; - } as any as QRLInternal; + } as QRLInternal; const setContainer = (el: Element | undefined) => { if (!_containerEl) { diff --git a/packages/qwik/src/core/qrl/qrl.public.ts b/packages/qwik/src/core/qrl/qrl.public.ts index 35256ead799..395b14fac9e 100644 --- a/packages/qwik/src/core/qrl/qrl.public.ts +++ b/packages/qwik/src/core/qrl/qrl.public.ts @@ -138,16 +138,6 @@ export type QRL = { __qwik_serializable__?: any; __brand__QRL__: TYPE; - /** - * Resolve the QRL of closure and invoke it. - * - * @param args - Closure arguments. - * @returns A promise of the return value of the closure. - */ - ( - ...args: TYPE extends (...args: infer ARGS) => any ? ARGS : never - ): Promise infer RETURN ? Awaited : never>; - /** Resolve the QRL and return the actual value. */ resolve(): Promise; /** The resolved value, once `resolve()` returns. */ @@ -157,7 +147,18 @@ export type QRL = { getSymbol(): string; getHash(): string; dev: QRLDev | null; -}; +} & BivariantQrlFn, QrlReturn>; + +// https://stackoverflow.com/questions/52667959/what-is-the-purpose-of-bivariancehack-in-typescript-types/52668133#52668133 +type BivariantQrlFn = { + /** + * Resolve the QRL of closure and invoke it. + * + * @param args - Closure arguments. + * @returns A promise of the return value of the closure. + */ + bivarianceHack(...args: ARGS): Promise; +}['bivarianceHack']; /** @public */ export type PropFnInterface = {