mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
[relay-runtime] augment NormalizationSelection (#38351)
* augment ReaderSelection * augment NormalizationSelection * test for ConcreteRequest * fix linter issues
This commit is contained in:
8
types/relay-runtime/index.d.ts
vendored
8
types/relay-runtime/index.d.ts
vendored
@@ -465,6 +465,11 @@ export interface NormalizationDefer {
|
||||
readonly selections: ReadonlyArray<NormalizationSelection>;
|
||||
}
|
||||
|
||||
export interface NormalizationClientExtension {
|
||||
kind: string; // 'ClientExtension';
|
||||
selections: ReadonlyArray<NormalizationSelection>;
|
||||
}
|
||||
|
||||
export type NormalizationField = NormalizationScalarField | NormalizationLinkedField | NormalizationMatchField;
|
||||
|
||||
export interface NormalizationLinkedField {
|
||||
@@ -509,6 +514,7 @@ export interface NormalizationScalarField {
|
||||
|
||||
export type NormalizationSelection =
|
||||
| NormalizationCondition
|
||||
| NormalizationClientExtension
|
||||
| NormalizationField
|
||||
| NormalizationHandle
|
||||
| NormalizationInlineFragment
|
||||
@@ -728,7 +734,7 @@ interface ReaderCondition {
|
||||
}
|
||||
|
||||
interface ReaderClientExtension {
|
||||
readonly kind: 'ClientExtension';
|
||||
readonly kind: string; // 'ClientExtension';
|
||||
readonly selections: ReadonlyArray<ReaderSelection>;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import {
|
||||
ConcreteRequest,
|
||||
Environment,
|
||||
Network,
|
||||
RecordSource,
|
||||
@@ -75,3 +76,80 @@ commitLocalUpdate(environment, store => {
|
||||
const root = store.get(ROOT_ID)!;
|
||||
root.setValue('foo', 'localKey');
|
||||
});
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~
|
||||
// ConcreteRequest
|
||||
// ~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
/*
|
||||
# client schema
|
||||
extend type Query {
|
||||
foo: Boolean!
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
// component
|
||||
graphql`
|
||||
query FooQuery {
|
||||
__typename
|
||||
foo
|
||||
}
|
||||
`;
|
||||
*/
|
||||
|
||||
/*
|
||||
query FooQuery {
|
||||
__typename
|
||||
}
|
||||
*/
|
||||
|
||||
/* tslint:disable:only-arrow-functions no-var-keyword prefer-const */
|
||||
const node: ConcreteRequest = (function() {
|
||||
var v0 = [
|
||||
{
|
||||
kind: 'ScalarField',
|
||||
alias: null,
|
||||
name: '__typename',
|
||||
args: null,
|
||||
storageKey: null,
|
||||
},
|
||||
{
|
||||
kind: 'ClientExtension',
|
||||
selections: [
|
||||
{
|
||||
kind: 'ScalarField',
|
||||
alias: null,
|
||||
name: 'foo',
|
||||
args: null,
|
||||
storageKey: null,
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
return {
|
||||
kind: 'Request',
|
||||
fragment: {
|
||||
kind: 'Fragment',
|
||||
name: 'FooQuery',
|
||||
type: 'Query',
|
||||
metadata: null,
|
||||
argumentDefinitions: [],
|
||||
selections: v0 /*: any*/,
|
||||
},
|
||||
operation: {
|
||||
kind: 'Operation',
|
||||
name: 'FooQuery',
|
||||
argumentDefinitions: [],
|
||||
selections: v0 /*: any*/,
|
||||
},
|
||||
params: {
|
||||
operationKind: 'query',
|
||||
name: 'FooQuery',
|
||||
id: null,
|
||||
text: 'query FooQuery {\n __typename\n}\n',
|
||||
metadata: {},
|
||||
},
|
||||
};
|
||||
})();
|
||||
/* tslint:enable:only-arrow-functions no-var-keyword prefer-const */
|
||||
|
||||
Reference in New Issue
Block a user