Skip to content

Commit

Permalink
graphql: Correct the type of ResourceReturn for solid 1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
thetarnav committed Aug 14, 2022
1 parent c8dc01c commit 7ac41ed
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 5 deletions.
61 changes: 61 additions & 0 deletions .changeset/seven-adults-count.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
"@solid-primitives/active-element": patch
"@solid-primitives/analytics": patch
"@solid-primitives/audio": patch
"@solid-primitives/bounds": patch
"@solid-primitives/clipboard": patch
"@solid-primitives/composites": patch
"@solid-primitives/connectivity": patch
"@solid-primitives/context": patch
"@solid-primitives/date": patch
"@solid-primitives/destructure": patch
"@solid-primitives/devices": patch
"@solid-primitives/event-bus": patch
"@solid-primitives/event-listener": patch
"@solid-primitives/event-props": patch
"@solid-primitives/fetch": patch
"@solid-primitives/fullscreen": patch
"@solid-primitives/geolocation": patch
"@solid-primitives/gestures": patch
"@solid-primitives/graphql": patch
"@solid-primitives/i18n": patch
"@solid-primitives/immutable": patch
"@solid-primitives/input-mask": patch
"@solid-primitives/intersection-observer": patch
"@solid-primitives/keyboard": patch
"@solid-primitives/keyed": patch
"@solid-primitives/map": patch
"@solid-primitives/media": patch
"@solid-primitives/memo": patch
"@solid-primitives/mouse": patch
"@solid-primitives/mutation-observer": patch
"@solid-primitives/page-visibility": patch
"@solid-primitives/permission": patch
"@solid-primitives/platform": patch
"@solid-primitives/pointer": patch
"@solid-primitives/promise": patch
"@solid-primitives/props": patch
"@solid-primitives/raf": patch
"@solid-primitives/range": patch
"@solid-primitives/reducer": patch
"@solid-primitives/refs": patch
"@solid-primitives/resize-observer": patch
"@solid-primitives/rootless": patch
"@solid-primitives/scheduled": patch
"@solid-primitives/script-loader": patch
"@solid-primitives/scroll": patch
"@solid-primitives/selection": patch
"@solid-primitives/set": patch
"@solid-primitives/share": patch
"@solid-primitives/signal-builders": patch
"@solid-primitives/storage": patch
"@solid-primitives/stream": patch
"@solid-primitives/timer": patch
"@solid-primitives/tween": patch
"@solid-primitives/upload": patch
"@solid-primitives/utils": patch
"@solid-primitives/websocket": patch
"@solid-primitives/workers": patch
---

Update to solid-js version 1.5
5 changes: 5 additions & 0 deletions .changeset/unlucky-ducks-serve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@solid-primitives/graphql": patch
---

Correct the type of ResourceReturn for solid 1.5
6 changes: 3 additions & 3 deletions packages/graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"start": "vite serve dev",
"dev": "vite serve dev",
"build": "tsup",
"test": "echo disabled defunct test suite",
"test": "vitest",
"gqlgen": "graphql-codegen --config dev/codegen.yml"
},
"keywords": [
Expand All @@ -61,9 +61,9 @@
"tsup": "^6.2.2",
"typescript": "^4.7.4",
"unocss": "^0.44.7",
"uvu": "^0.5.6",
"vite": "^3.0.7",
"vite-plugin-solid": "^2.3.0"
"vite-plugin-solid": "^2.3.0",
"vitest": "^0.20.3"
},
"peerDependencies": {
"solid-js": "^1.4.3"
Expand Down
4 changes: 2 additions & 2 deletions packages/graphql/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ export type GraphQLClientQuery = {
query: string | DocumentNode | TypedDocumentNode<T, V>,
variables: MaybeAccessor<V | FalsyValue> | undefined,
initialValue: T
): ResourceReturn<T, { initialValue: T }>;
): ResourceReturn<T>;
<T = unknown, V extends object = {}>(
query: string,
variables?: MaybeAccessor<V | FalsyValue>,
initialValue?: undefined
): ResourceReturn<T, undefined>;
): ResourceReturn<T | undefined>;
};

/**
Expand Down
9 changes: 9 additions & 0 deletions packages/graphql/test/exports.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { test, expect } from "vitest";
import * as API from "../src";
import * as Server from "../src/server";

test("exports match between server and index", () => {
(Object.keys(API) as (keyof typeof API)[]).forEach(key => {
expect(typeof API[key]).toBe(typeof Server[key]);
});
});
2 changes: 2 additions & 0 deletions packages/graphql/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { vitestConfig } from "../../vite.config";
export default vitestConfig;

0 comments on commit 7ac41ed

Please sign in to comment.