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(qwik): restore bivarience hack #5587

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand All @@ -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/
Expand All @@ -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/
Expand Down Expand Up @@ -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/*
Expand Down Expand Up @@ -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/*
Expand All @@ -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/
Expand All @@ -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: |
Expand Down
7 changes: 5 additions & 2 deletions packages/qwik/src/core/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -609,18 +609,21 @@ export type PropsOf<COMP> = COMP extends Component<infer PROPS> ? NonNullable<PR
// @public
export type PublicProps<PROPS extends Record<any, any>> = TransformProps<PROPS> & ComponentBaseProps & ComponentChildren<PROPS>;

// 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<TYPE = unknown> = {
__qwik_serializable__?: any;
__brand__QRL__: TYPE;
(...args: TYPE extends (...args: infer ARGS) => any ? ARGS : never): Promise<TYPE extends (...args: any[]) => infer RETURN ? Awaited<RETURN> : never>;
resolve(): Promise<TYPE>;
resolved: undefined | TYPE;
getCaptured(): unknown[] | null;
getSymbol(): string;
getHash(): string;
dev: QRLDev | null;
};
} & BivariantQrlFn<QrlArgs<TYPE>, QrlReturn<TYPE>>;

// @public
export const qrl: <T = any>(chunkOrFn: string | (() => Promise<any>), symbol: string, lexicalScopeCapture?: any[], stackOffset?: number) => QRL<T>;
Expand Down
2 changes: 1 addition & 1 deletion packages/qwik/src/core/qrl/qrl-class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const createQRL = <TYPE>(
const fn = invokeFn.call(this, tryGetInvokeContext());
const result = await fn(...args);
return result;
} as any as QRLInternal<TYPE>;
} as QRLInternal<TYPE>;

const setContainer = (el: Element | undefined) => {
if (!_containerEl) {
Expand Down
23 changes: 12 additions & 11 deletions packages/qwik/src/core/qrl/qrl.public.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,6 @@ export type QRL<TYPE = unknown> = {
__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<TYPE extends (...args: any[]) => infer RETURN ? Awaited<RETURN> : never>;

/** Resolve the QRL and return the actual value. */
resolve(): Promise<TYPE>;
/** The resolved value, once `resolve()` returns. */
Expand All @@ -157,7 +147,18 @@ export type QRL<TYPE = unknown> = {
getSymbol(): string;
getHash(): string;
dev: QRLDev | null;
};
} & BivariantQrlFn<QrlArgs<TYPE>, QrlReturn<TYPE>>;

// https://stackoverflow.com/questions/52667959/what-is-the-purpose-of-bivariancehack-in-typescript-types/52668133#52668133
type BivariantQrlFn<ARGS extends any[], RETURN> = {
/**
* 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<RETURN>;
}['bivarianceHack'];

/** @public */
export type PropFnInterface<ARGS extends any[], RET> = {
Expand Down
Loading