@isograph/react 0.0.0-main-9692124d → 0.0.0-main-bee27aa9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@isograph/react",
3
- "version": "0.0.0-main-9692124d",
3
+ "version": "0.0.0-main-bee27aa9",
4
4
  "description": "Use Isograph with React",
5
5
  "homepage": "https://isograph.dev",
6
6
  "main": "dist/index.js",
@@ -16,8 +16,8 @@
16
16
  "prepack": "yarn run test && yarn run compile"
17
17
  },
18
18
  "dependencies": {
19
- "@isograph/disposable-types": "0.0.0-main-9692124d",
20
- "@isograph/react-disposable-state": "0.0.0-main-9692124d",
19
+ "@isograph/disposable-types": "0.0.0-main-bee27aa9",
20
+ "@isograph/react-disposable-state": "0.0.0-main-bee27aa9",
21
21
  "react": "^18.2.0"
22
22
  },
23
23
  "devDependencies": {
@@ -18,6 +18,22 @@ type Whitespace<In> = In extends `${WhitespaceCharacter}${infer In}`
18
18
  ? Whitespace<In>
19
19
  : In;
20
20
 
21
+ // This is a recursive TypeScript type that matches strings that
22
+ // start with whitespace, followed by TString. So e.g. if we have
23
+ // ```
24
+ // export function iso<T>(
25
+ // param: T & MatchesWhitespaceAndString<'field Query.foo', T>
26
+ // ): Bar;
27
+ // ```
28
+ // then, when you call
29
+ // ```
30
+ // const x = iso(`
31
+ // field Query.foo ...
32
+ // `);
33
+ // ```
34
+ // then the type of `x` will be `Bar`, both in VSCode and when running
35
+ // tsc. This is how we achieve type safety — you can only use fields
36
+ // that you have explicitly selected.
21
37
  type MatchesWhitespaceAndString<
22
38
  TString extends string,
23
39
  T