本文整理汇总了TypeScript中graphql-tag.disableFragmentWarnings函数的典型用法代码示例。如果您正苦于以下问题:TypeScript disableFragmentWarnings函数的具体用法?TypeScript disableFragmentWarnings怎么用?TypeScript disableFragmentWarnings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了disableFragmentWarnings函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: disableFragmentWarnings
import { ApolloCache } from 'apollo-cache';
import gql, { disableFragmentWarnings } from 'graphql-tag';
import { InMemoryCache, ApolloReducerConfig, NormalizedCache } from '..';
disableFragmentWarnings();
describe('Cache', () => {
function createCache({
initialState,
config,
}: {
initialState?: any;
config?: ApolloReducerConfig;
} = {}): ApolloCache<NormalizedCache> {
return new InMemoryCache(
config || { addTypename: false },
// XXX this is the old format. The tests need to be updated but since it is mapped down
).restore(initialState ? initialState.apollo.data : {});
}
describe('readQuery', () => {
it('will read some data from the store', () => {
const proxy = createCache({
initialState: {
apollo: {
data: {
ROOT_QUERY: {
a: 1,
b: 2,
c: 3,
开发者ID:NewSpring,项目名称:apollo-client,代码行数:31,代码来源:cache.ts
示例2: require
import { ApolloError } from '../src/errors/ApolloError';
import { withWarning } from './util/wrap';
import observableToPromise from './util/observableToPromise';
import cloneDeep = require('lodash.clonedeep');
import assign = require('lodash.assign');
// make it easy to assert with promises
chai.use(chaiAsPromised);
// Turn off warnings for repeated fragment names
disableFragmentWarnings();
graphqlTagDisableFragmentWarnings();
describe('client', () => {
it('does not require any arguments and creates store lazily', () => {
const client = new ApolloClient();
assert.isUndefined(client.store);
// We only create the store on the first query
client.initStore();
assert.isDefined(client.store);
assert.isDefined(client.store.getState().apollo);
});
it('can be loaded via require', () => {
/* tslint:disable */
开发者ID:drager,项目名称:apollo-client,代码行数:31,代码来源:client.ts
注:本文中的graphql-tag.disableFragmentWarnings函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论