Skip to content

Commit f94fa7d

Browse files
committed
fix: definitions for [email protected]
1 parent 685b027 commit f94fa7d

File tree

10 files changed

+22
-11
lines changed

10 files changed

+22
-11
lines changed

.flowconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,14 @@
3636
.*/node_modules/uglify.*
3737
.*/node_modules/yargs.*
3838

39+
# Ignore broken Missing type annotation for V. V is a type parameter declared in function [1] and was implicitly instantiated at call of keyValMap [2].
40+
.*/node_modules/graphql/utilities/buildASTSchema.js.flow
41+
3942
[include]
4043

4144
[libs]
4245

4346
[options]
4447
esproposal.class_instance_fields=enable
48+
esproposal.optional_chaining=enable
4549
suppress_comment= \\(.\\|\n\\)*\\$FlowFixMe

src/__mocks__/contactsSchema.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
/* @flow */
22

3+
import type { Schema as SchemaType } from 'mongoose';
34
import { Schema } from './mongooseCommon';
45

5-
const ContactsSchema = new Schema({
6+
const ContactsSchema: SchemaType<any> = new Schema({
67
phones: [String],
78
email: String,
89
skype: String,

src/__mocks__/languageSchema.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* @flow */
22

3+
import type { Schema as SchemaType } from 'mongoose';
34
import { schemaComposer } from 'graphql-compose';
45
import { Schema } from './mongooseCommon';
56
import { convertSchemaToGraphQL } from '../fieldsConverter';
@@ -18,7 +19,7 @@ const enumLanguageSkill = {
1819
native: { description: 'since birth' },
1920
};
2021

21-
const LanguageSchema = new Schema({
22+
const LanguageSchema: SchemaType<any> = new Schema({
2223
ln: {
2324
type: String,
2425
description: 'Language names (https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes)',

src/__mocks__/postModel.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
/* @flow */
22

3+
import type { Schema as SchemaType } from 'mongoose';
34
import { mongoose, Schema } from './mongooseCommon';
45

5-
const PostSchema = new Schema({
6+
const PostSchema: SchemaType<any> = new Schema({
67
_id: {
78
type: Number,
89
},

src/__mocks__/userModel.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
/* @flow */
22

3+
import type { Schema as SchemaType } from 'mongoose';
34
import { mongoose, Schema } from './mongooseCommon';
45
import ContactsSchema from './contactsSchema';
56
import enumEmployment from './enumEmployment';
67
import LanguageSchema from './languageSchema';
78

8-
const UserSchema = new Schema(
9+
const UserSchema: SchemaType<any> = new Schema(
910
{
1011
subDoc: {
1112
field1: String,

src/discriminators/__mocks__/characterModels.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* @flow */
22

3+
import type { MongooseModel } from 'mongoose';
34
import { mongoose, Schema, Types } from '../../__mocks__/mongooseCommon';
45
import { DroidSchema } from './droidSchema';
56
import { PersonSchema } from './personSchema';
@@ -37,15 +38,15 @@ const ACharacterSchema = new Schema(Object.assign({}, CharacterObject));
3738
export function getCharacterModels(DKey: string) {
3839
CharacterSchema.set('discriminatorKey', DKey);
3940

40-
const CharacterModel = mongoose.models.Character
41+
const CharacterModel: MongooseModel = mongoose.models.Character
4142
? mongoose.models.Character
4243
: mongoose.model('Character', CharacterSchema);
4344

44-
const PersonModel = mongoose.models[enumCharacterType.PERSON]
45+
const PersonModel: MongooseModel = mongoose.models[enumCharacterType.PERSON]
4546
? mongoose.models[enumCharacterType.PERSON]
4647
: CharacterModel.discriminator(enumCharacterType.PERSON, PersonSchema);
4748

48-
const DroidModel = mongoose.models[enumCharacterType.DROID]
49+
const DroidModel: MongooseModel = mongoose.models[enumCharacterType.DROID]
4950
? mongoose.models[enumCharacterType.DROID]
5051
: CharacterModel.discriminator(enumCharacterType.DROID, DroidSchema);
5152

src/discriminators/__mocks__/droidSchema.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
/* @flow */
22

3+
import type { Schema as SchemaType } from 'mongoose';
34
import { Schema } from '../../__mocks__/mongooseCommon';
45

5-
export const DroidSchema = new Schema({
6+
export const DroidSchema: SchemaType<any> = new Schema({
67
makeDate: Date,
78
modelNumber: Number,
89
primaryFunction: [String],

src/discriminators/__mocks__/personSchema.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
/* @flow */
22

3+
import type { Schema as SchemaType } from 'mongoose';
34
import { Schema } from '../../__mocks__/mongooseCommon';
45

5-
export const PersonSchema = new Schema({
6+
export const PersonSchema: SchemaType<any> = new Schema({
67
dob: Number,
78
starShips: [String],
89
totalCredits: Number,

src/discriminators/utils/mergeTypeConverterResolversOpts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ export function mergeTypeConverterResolverOpts(
143143
}
144144

145145
// if nothing set for child resolver set base
146-
if (baseResolverArgs === false && childResolverArgs === undefined) {
146+
if ((baseResolverArgs: any) === false && childResolverArgs === undefined) {
147147
mergedTypeConverterResolverOpts[baseResolverOpt] = false;
148148
continue; // eslint-disable-line no-continue
149149
}

src/resolvers/helpers/filterOperators.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export function _createOperatorsField(
106106
// if `opts.resolvers.[resolverName].filter.operators` is empty and not disabled via `false`
107107
// then fill it up with indexed fields
108108
const indexedFields = getIndexedFieldNamesForGraphQL(model);
109-
if (operatorsOpts !== false && Object.keys(operatorsOpts).length === 0) {
109+
if (Object.keys(operatorsOpts).length === 0) {
110110
indexedFields.forEach(fieldName => {
111111
operatorsOpts[fieldName] = availableOperators; // eslint-disable-line
112112
});

0 commit comments

Comments
 (0)